Move delete to existing if/else tree

reviewable/pr2648/r5
Scott Rigby 8 years ago
parent 88897da954
commit 4fc7792ad2

@ -278,18 +278,16 @@ func coalesceValues(c *chart.Chart, v map[string]interface{}) (map[string]interf
} }
for key, val := range nv { for key, val := range nv {
// When the YAML value is null, we remove the value's key.
// This allows Helm's various sources of values (value files or --set) to
// remove incompatible keys from any previous chart, file, or set values.
// ref: http://www.yaml.org/spec/1.2/spec.html#id2803362
if val == nil {
delete(v, key)
continue
}
if _, ok := v[key]; !ok { if _, ok := v[key]; !ok {
// If the key is not in v, copy it from nv. // If the key is not in v, copy it from nv.
v[key] = val v[key] = val
} else if ok && v[key] == nil {
// When the YAML value is null, we remove the value's key.
// This allows Helm's various sources of values (value files or --set) to
// remove incompatible keys from any previous chart, file, or set values.
// ref: http://www.yaml.org/spec/1.2/spec.html#id2803362
delete(v, key)
continue
} else if dest, ok := v[key].(map[string]interface{}); ok { } else if dest, ok := v[key].(map[string]interface{}); ok {
// if v[key] is a table, merge nv's val table into v[key]. // if v[key] is a table, merge nv's val table into v[key].
src, ok := val.(map[string]interface{}) src, ok := val.(map[string]interface{})

Loading…
Cancel
Save