1
0
Fork 0

Fix missing indirection in field collection

This commit is contained in:
Gregory Eremin 2015-08-29 16:23:53 +03:00
parent 3a5e7a894c
commit 360dd2d3c7
1 changed files with 6 additions and 1 deletions

View File

@ -12,8 +12,13 @@ type field struct {
func extractFields(st interface{}, path string) map[string]field {
res := make(map[string]field)
typ := reflect.TypeOf(st)
val := reflect.ValueOf(st)
if val.Kind() == reflect.Ptr {
val = reflect.Indirect(val)
}
typ := val.Type()
for i := 0; i < val.NumField(); i++ {
ftyp := typ.Field(i)
fval := val.Field(i)