From bed1a42a398b30a63a279d68cc7319ceb4618ec3 Mon Sep 17 00:00:00 2001 From: Marc Khouzam Date: Sat, 12 Dec 2020 21:54:11 -0500 Subject: [PATCH] fix(pkg/chartutil): Remove warning for nils Nil tables should not be reported as non-tables. Signed-off-by: Marc Khouzam --- pkg/chartutil/coalesce.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/chartutil/coalesce.go b/pkg/chartutil/coalesce.go index 1d3d45e99..e086d8b6e 100644 --- a/pkg/chartutil/coalesce.go +++ b/pkg/chartutil/coalesce.go @@ -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) } }