summaryrefslogtreecommitdiffstats
path: root/adapter
diff options
context:
space:
mode:
Diffstat (limited to 'adapter')
-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
}