From 5c37babcec5f63a2679310a5917160b8e528683e Mon Sep 17 00:00:00 2001 From: Kailash Nadh Date: Wed, 3 Apr 2024 12:46:15 +0530 Subject: [PATCH] Fix map unflattening no-delimiter behaviour (#278). Closes #275. --- maps/maps.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/maps/maps.go b/maps/maps.go index 0a409f9a..bdb9d62b 100644 --- a/maps/maps.go +++ b/maps/maps.go @@ -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] {