update getNested utility to better handle slice fields
This commit is contained in:
parent
5a8f2301fc
commit
e018dad91e
5
util.go
5
util.go
@ -58,6 +58,11 @@ func getNested(field string, aValue reflect.Value) (*reflect.Type, *reflect.Valu
|
|||||||
if strings.HasPrefix(field, ".") || strings.HasSuffix(field, ".") {
|
if strings.HasPrefix(field, ".") || strings.HasSuffix(field, ".") {
|
||||||
return nil, nil, fmt.Errorf(errFmtMalformedField, field)
|
return nil, nil, fmt.Errorf(errFmtMalformedField, field)
|
||||||
}
|
}
|
||||||
|
value := aValue
|
||||||
|
if value.Kind() == reflect.Pointer {
|
||||||
|
value = value.Elem()
|
||||||
|
}
|
||||||
|
aft := value.Type()
|
||||||
dots := strings.Split(field, ".")
|
dots := strings.Split(field, ".")
|
||||||
if value.Kind() != reflect.Struct /*&& arrRegex.FindString(dots[0]) == ""*/ {
|
if value.Kind() != reflect.Struct /*&& arrRegex.FindString(dots[0]) == ""*/ {
|
||||||
if value.Kind() == reflect.Slice {
|
if value.Kind() == reflect.Slice {
|
||||||
|
Loading…
Reference in New Issue
Block a user