fix(pkg/chartutil): Remove warning for nils

Nil tables should not be reported as non-tables.

Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
pull/9142/head
Marc Khouzam 5 years ago committed by Marc Khouzam
parent e71d38b414
commit bed1a42a39

@ -157,7 +157,11 @@ func coalesceValues(c *chart.Chart, v map[string]interface{}) {
// if v[key] is a table, merge nv's val table into v[key].
src, ok := val.(map[string]interface{})
if !ok {
log.Printf("warning: skipped value for %s: Not a table.", key)
// If the original value is nil, there is nothing to coalesce, so we don't print
// the warning but simply continue
if val != nil {
log.Printf("warning: skipped value for %s: Not a table.", key)
}
continue
}
// Because v has higher precedence than nv, dest values override src
@ -195,7 +199,7 @@ func CoalesceTables(dst, src map[string]interface{}) map[string]interface{} {
} else {
log.Printf("warning: cannot overwrite table with non table for %s (%v)", key, val)
}
} else if istable(dv) {
} else if istable(dv) && val != nil {
log.Printf("warning: destination for %s is a table. Ignoring non-table value %v", key, val)
}
}

Loading…
Cancel
Save