Fix missing indirection in field collection
This commit is contained in:
parent
3a5e7a894c
commit
360dd2d3c7
7
field.go
7
field.go
|
@ -12,8 +12,13 @@ type field struct {
|
||||||
|
|
||||||
func extractFields(st interface{}, path string) map[string]field {
|
func extractFields(st interface{}, path string) map[string]field {
|
||||||
res := make(map[string]field)
|
res := make(map[string]field)
|
||||||
typ := reflect.TypeOf(st)
|
|
||||||
val := reflect.ValueOf(st)
|
val := reflect.ValueOf(st)
|
||||||
|
if val.Kind() == reflect.Ptr {
|
||||||
|
val = reflect.Indirect(val)
|
||||||
|
}
|
||||||
|
typ := val.Type()
|
||||||
|
|
||||||
for i := 0; i < val.NumField(); i++ {
|
for i := 0; i < val.NumField(); i++ {
|
||||||
ftyp := typ.Field(i)
|
ftyp := typ.Field(i)
|
||||||
fval := val.Field(i)
|
fval := val.Field(i)
|
||||||
|
|
Loading…
Reference in New Issue