summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Macko <lmacko@cisco.com>2017-06-09 13:16:57 +0200
committerLukas Macko <lmacko@cisco.com>2017-06-09 13:22:08 +0200
commit878bade578bb9d52547591ee02b57d1ac04849b2 (patch)
treefec0c5c2c08efafcc1f797c8ea4d0a8088a3ddf3
parent2d07847237e754d9050f06f565baa430c70ed937 (diff)
Fix name of fields
Change-Id: I9dd1ab75c3619e6ddc6cf07491491b556b96fb20 Signed-off-by: Lukas Macko <lmacko@cisco.com>
-rw-r--r--adapter/mock/binapi/binapi_reflect.go10
1 files 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
}