From 4fc7792ad2600473a35a0d8a6ebd8c7be8304135 Mon Sep 17 00:00:00 2001 From: Scott Rigby Date: Thu, 6 Jul 2017 21:08:25 -0400 Subject: [PATCH] Move delete to existing if/else tree --- pkg/chartutil/values.go | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/pkg/chartutil/values.go b/pkg/chartutil/values.go index c6592c767..a2343555e 100644 --- a/pkg/chartutil/values.go +++ b/pkg/chartutil/values.go @@ -278,18 +278,16 @@ func coalesceValues(c *chart.Chart, v map[string]interface{}) (map[string]interf } 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 the key is not in v, copy it from nv. 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 { // if v[key] is a table, merge nv's val table into v[key]. src, ok := val.(map[string]interface{})