improved coalesce readability by getting rid of continue statements

Signed-off-by: Bernd Gutjahr <bernd.gutjahr@microfocus.com>
pull/9333/head
Bernd Gutjahr 4 years ago
parent 1740e7f89b
commit 5cf9735a9d

@ -120,13 +120,11 @@ func coalesceGlobals(dest, src map[string]interface{}) {
// top-down. // top-down.
CoalesceTables(vv, destvmap) CoalesceTables(vv, destvmap)
dg[key] = vv dg[key] = vv
continue
} }
} }
} else if dv, ok := dg[key]; ok && istable(dv) { } else if dv, ok := dg[key]; ok && istable(dv) {
// It's not clear if this condition can actually ever trigger. // It's not clear if this condition can actually ever trigger.
log.Printf("key %s is table. Skipping", key) log.Printf("key %s is table. Skipping", key)
continue
} else { } else {
// TODO: Do we need to do any additional checking on the value? // TODO: Do we need to do any additional checking on the value?
dg[key] = val dg[key] = val
@ -159,15 +157,15 @@ func coalesceValues(c *chart.Chart, v map[string]interface{}) {
src, ok := val.(map[string]interface{}) src, ok := val.(map[string]interface{})
if !ok { if !ok {
// If the original value is nil, there is nothing to coalesce, so we don't print // If the original value is nil, there is nothing to coalesce, so we don't print
// the warning but simply continue // the warning
if val != nil { if val != nil {
log.Printf("warning: skipped value for %s: Not a table.", key) log.Printf("warning: skipped value for %s: Not a table.", key)
} }
continue } else {
// Because v has higher precedence than nv, dest values override src
// values.
CoalesceTables(dest, src)
} }
// Because v has higher precedence than nv, dest values override src
// values.
CoalesceTables(dest, src)
} }
} else { } else {
// If the key is not in v, copy it from nv. // If the key is not in v, copy it from nv.

Loading…
Cancel
Save