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{} {
4747 }
4848
4949 // 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+
5258 if mapValue := v .MapIndex (reflect .ValueOf (joinedPath )); mapValue .IsValid () {
5359 if i == len (path ) {
5460 return mapValue .Interface ()
5561 }
56- return deepGetImpl (mapValue , path [i :])
62+ return deepGetImpl (mapValue , path [i + 1 :])
5763 }
5864 }
5965
You can’t perform that action at this time.
0 commit comments