Commit 3b11d57e
3b11d57ec00fMerged
Svyatoslav Dumchenko <[email protected]> ยท 4 years ago ยท 1 file ยท ~1 modified
Description
Revert changes to template.Values alias
Details
- Commit
- 3b11d57ec00f
- Parent
- 95d086fd8164
pkg/template/extra.gomodifiedView file
@@ -13,7 +13,7 @@
1313
)1414
1515
// Values is alias for string map of interfaces.16-
type Values map[string]interface{}16+
type Values = map[string]interface{}1717
1818
// ToYaml renders data into YAML string.1919
// Used as custom template function.@@ -121,12 +121,6 @@
121121
122122
for _, k := range pathToMap {123123
switch typedCurrent := current.(type) {124-
case Values:125-
v, exists := typedCurrent[k]126-
if !exists {127-
return nil, fmt.Errorf("failed to set value at path \"%s\": value for key \"%s\" does not exist", path, k)128-
}129-
current = v130124
case map[string]interface{}:131125
v, exists := typedCurrent[k]132126
if !exists {@@ -154,8 +148,6 @@
154148
typedCurrent[key] = value155149
case map[interface{}]interface{}:156150
typedCurrent[key] = value157-
case Values:158-
typedCurrent[key] = value159151
default:160152
return nil, fmt.Errorf(161153
"failed to set value at path \"%s\": value for key \"%s\" is not a map: %+v",@@ -246,15 +238,6 @@
246238
var v interface{}247239
var ok bool248240
switch typedObj := obj.(type) {249-
case Values:250-
v, ok = typedObj[keys[0]]251-
if !ok {252-
if defSet {253-
return def, nil254-
}255-
256-
return nil, &noValueError{fmt.Sprintf("no value exist for key %q in %v", keys[0], typedObj)}257-
}258241
case map[string]interface{}:259242
v, ok = typedObj[keys[0]]260243
if !ok {@@ -336,11 +319,6 @@
336319
var v interface{}337320
var ok bool338321
switch typedObj := obj.(type) {339-
case Values:340-
v, ok = typedObj[keys[0]]341-
if !ok {342-
return defSet, nil343-
}344322
case map[string]interface{}:345323
v, ok = typedObj[keys[0]]346324
if !ok {