Skip to content

Commit

Permalink
Fix map unflattening no-delimiter behaviour (#278). Closes #275.
Browse files Browse the repository at this point in the history
  • Loading branch information
knadh committed Apr 3, 2024
1 parent 736ad3a commit 5c37bab
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion maps/maps.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,16 @@ func Unflatten(m map[string]interface{}, delim string) map[string]interface{} {
// Iterate through the flat conf map.
for k, v := range m {
var (
keys = strings.Split(k, delim)
keys []string
next = out
)

if delim != "" {
keys = strings.Split(k, delim)
} else {
keys = []string{k}
}

// Iterate through key parts, for eg:, parent.child.key
// will be ["parent", "child", "key"]
for _, k := range keys[:len(keys)-1] {
Expand Down

0 comments on commit 5c37bab

Please sign in to comment.