From b8e8eddd01b6a02ed4846c36747dc5b4f9eef5ee Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Mon, 13 Dec 2021 12:15:04 +0100 Subject: [PATCH] fix: remove map cache --- src/template_func.go | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/template_func.go b/src/template_func.go index acd062ff..c407db83 100644 --- a/src/template_func.go +++ b/src/template_func.go @@ -9,21 +9,16 @@ import ( "github.com/Masterminds/sprig/v3" ) -var funcMapCache map[string]interface{} - func funcMap() template.FuncMap { - if funcMapCache != nil { - return template.FuncMap(funcMapCache) - } - funcMapCache = map[string]interface{}{ + funcMap := map[string]interface{}{ "secondsRound": secondsRound, } for key, fun := range sprig.TxtFuncMap() { - if _, ok := funcMapCache[key]; !ok { - funcMapCache[key] = fun + if _, ok := funcMap[key]; !ok { + funcMap[key] = fun } } - return template.FuncMap(funcMapCache) + return template.FuncMap(funcMap) } func parseSeconds(seconds interface{}) (int, error) {