chore: use text/template (#17358)

This commit is contained in:
Roland Huß 2024-11-21 18:12:07 +01:00 • committed by GitHub
parent cdc5bdb753
commit 037aeaa63a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3,11 +3,11 @@ package util
import (
"bytes"
"fmt"
"html/template"
"maps"
"regexp"
"slices"
"strings"
"text/template"
"time"
"github.com/Masterminds/sprig/v3"
@ -50,7 +50,7 @@ func FormatValue(format string, val interface{}) string {
func ReplaceFormatted(s string, kv map[string]interface{}) (string, error) {
// Enhanced golang template logic
tpl, err := template.New("base").
Funcs(sprig.FuncMap()).
Funcs(sprig.TxtFuncMap()).
Funcs(map[string]any{
"timeRound": timeRound,
}).Parse(s)