From 1d1636d0da5b08ae7bdd7ef2199129bf9d4f9028 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helgi=20=C3=9Eorbj=C3=B6rnsson?= Date: Mon, 8 Oct 2018 22:24:47 -0700 Subject: [PATCH] Return empty string instead of nil when linting on required MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows lint to work in scenarios when required is used in secrets or it's output is passed to another function. Due to lint mode no longer failing on missing value in required it is passing nil through which not all functions can accept. Fixes #4747 Signed-off-by: Helgi Þorbjörnsson --- pkg/engine/engine.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/engine/engine.go b/pkg/engine/engine.go index 9f212ba09..118733b6c 100644 --- a/pkg/engine/engine.go +++ b/pkg/engine/engine.go @@ -161,7 +161,8 @@ func (e *Engine) alterFuncMap(t *template.Template, referenceTpls map[string]ren log.Printf("[INFO] Missing required value: %s", warn) return val, nil } - return val, fmt.Errorf(warn) + // Convert nil to "" in case required is piped into other functions + return "", fmt.Errorf(warn) } else if _, ok := val.(string); ok { if val == "" { if e.LintMode {