Skip to content

Commit 5c37bab

Browse files
authored
Fix map unflattening no-delimiter behaviour (#278). Closes #275.
1 parent 736ad3a commit 5c37bab

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

maps/maps.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,16 @@ func Unflatten(m map[string]interface{}, delim string) map[string]interface{} {
7474
// Iterate through the flat conf map.
7575
for k, v := range m {
7676
var (
77-
keys = strings.Split(k, delim)
77+
keys []string
7878
next = out
7979
)
8080

81+
if delim != "" {
82+
keys = strings.Split(k, delim)
83+
} else {
84+
keys = []string{k}
85+
}
86+
8187
// Iterate through key parts, for eg:, parent.child.key
8288
// will be ["parent", "child", "key"]
8389
for _, k := range keys[:len(keys)-1] {

0 commit comments

Comments
 (0)