From eda961edc2cdc6cf2dd6f5e71693bcd24997e178 Mon Sep 17 00:00:00 2001 From: KUOKA Yusuke Date: Sat, 27 Jul 2019 22:57:54 +0900 Subject: [PATCH] fix: --state-values-set not setting more than first child in nested paths (#774) Fixes #773 --- pkg/maputil/maputil.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pkg/maputil/maputil.go b/pkg/maputil/maputil.go index 8a1ef45c..76b2fe82 100644 --- a/pkg/maputil/maputil.go +++ b/pkg/maputil/maputil.go @@ -76,8 +76,13 @@ func Set(m map[string]interface{}, key []string, value string) map[string]interf nested, ok := m[k] if !ok { - new_m := map[string]interface{}{} - nested = Set(new_m, remain, value) + nested = map[string]interface{}{} + } + switch t := nested.(type) { + case map[string]interface{}: + nested = Set(t, remain, value) + default: + panic(fmt.Errorf("unexpected type: %v(%T)", t, t)) } m[k] = nested