fix: --state-values-set not setting more than first child in nested paths (#774)

Fixes #773
This commit is contained in:
KUOKA Yusuke 2019-07-27 22:57:54 +09:00 committed by GitHub
parent b2a6231dcf
commit eda961edc2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -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