File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -47,13 +47,19 @@ func deepGetImpl(v reflect.Value, path []string) interface{} {
47
47
}
48
48
49
49
// If the first part of the path is not a key in the map, we try to find a valid key by joining the path parts
50
- for i := 2 ; i <= len (path ); i ++ {
51
- joinedPath := strings .Join (path [0 :i ], "." )
50
+ var builder strings.Builder
51
+ for i , pathPart := range path {
52
+ if i > 0 {
53
+ builder .WriteString ("." )
54
+ }
55
+ builder .WriteString (pathPart )
56
+ joinedPath := builder .String ()
57
+
52
58
if mapValue := v .MapIndex (reflect .ValueOf (joinedPath )); mapValue .IsValid () {
53
59
if i == len (path ) {
54
60
return mapValue .Interface ()
55
61
}
56
- return deepGetImpl (mapValue , path [i :])
62
+ return deepGetImpl (mapValue , path [i + 1 :])
57
63
}
58
64
}
59
65
You can’t perform that action at this time.
0 commit comments