fix: remove map cache

This commit is contained in:
Jan De Dobbeleer 2021-12-13 12:15:04 +01:00
parent 0fb5951375
commit b8e8eddd01
No known key found for this signature in database
GPG key ID: F6CC273CE5BA9AEE

View file

@ -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) {