From 878bade578bb9d52547591ee02b57d1ac04849b2 Mon Sep 17 00:00:00 2001 From: Lukas Macko Date: Fri, 9 Jun 2017 13:16:57 +0200 Subject: Fix name of fields Change-Id: I9dd1ab75c3619e6ddc6cf07491491b556b96fb20 Signed-off-by: Lukas Macko --- adapter/mock/binapi/binapi_reflect.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/adapter/mock/binapi/binapi_reflect.go b/adapter/mock/binapi/binapi_reflect.go index ee89909..1aeec1d 100644 --- a/adapter/mock/binapi/binapi_reflect.go +++ b/adapter/mock/binapi/binapi_reflect.go @@ -20,18 +20,18 @@ import ( "reflect" ) -const swIfIndexName = "swIfIndex" -const retvalName = "retval" +const swIfIndexName = "SwIfIndex" +const retvalName = "Retval" const replySuffix = "_reply" // findFieldOfType finds the field specified by its name in provided message defined as reflect.Type data type. func findFieldOfType(reply reflect.Type, fieldName string) (reflect.StructField, bool) { + for reply.Kind() == reflect.Ptr { + reply = reply.Elem() + } if reply.Kind() == reflect.Struct { field, found := reply.FieldByName(fieldName) return field, found - } else if reply.Kind() == reflect.Ptr && reply.Elem().Kind() == reflect.Struct { - field, found := reply.Elem().FieldByName(fieldName) - return field, found } return reflect.StructField{}, false } -- cgit 1.2.3-korg