From e018dad91e73a798d3ee7a2433b5ff8500feb1eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=98=99=E2=97=A6=20The=20Tablet=20=E2=9D=80=20GamerGirla?= =?UTF-8?q?ndCo=20=E2=97=A6=E2=9D=A7?= Date: Thu, 12 Sep 2024 17:50:31 -0400 Subject: [PATCH] update getNested utility to better handle slice fields --- util.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/util.go b/util.go index eedccf6..552585e 100644 --- a/util.go +++ b/util.go @@ -58,6 +58,11 @@ func getNested(field string, aValue reflect.Value) (*reflect.Type, *reflect.Valu if strings.HasPrefix(field, ".") || strings.HasSuffix(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, ".") if value.Kind() != reflect.Struct /*&& arrRegex.FindString(dots[0]) == ""*/ { if value.Kind() == reflect.Slice {