From 892e82ceb8363076a69b9809445ab4c9b712801a Mon Sep 17 00:00:00 2001 From: binwiederhier Date: Sat, 19 Jul 2025 22:41:53 +0200 Subject: [PATCH] Remove underscore functions --- util/sprig/date_test.go | 4 ++-- util/sprig/functions.go | 29 +++++++++++++---------------- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/util/sprig/date_test.go b/util/sprig/date_test.go index 3ebfa2be..496822cf 100644 --- a/util/sprig/date_test.go +++ b/util/sprig/date_test.go @@ -52,7 +52,7 @@ func TestDateInZone(t *testing.T) { if err != nil { t.Error(err) } - tpl := `{{ date_in_zone "02 Jan 06 15:04 -0700" .Time "UTC" }}` + tpl := `{{ dateInZone "02 Jan 06 15:04 -0700" .Time "UTC" }}` // Test time.Time input if err = runtv(tpl, "13 Jun 19 20:39 +0000", map[string]any{"Time": tm}); err != nil { @@ -86,7 +86,7 @@ func TestDateInZone(t *testing.T) { } // Test case of invalid timezone - tpl = `{{ date_in_zone "02 Jan 06 15:04 -0700" .Time "foobar" }}` + tpl = `{{ dateInZone "02 Jan 06 15:04 -0700" .Time "foobar" }}` if err = runtv(tpl, "13 Jun 19 20:39 +0000", map[string]any{"Time": tm}); err != nil { t.Error(err) } diff --git a/util/sprig/functions.go b/util/sprig/functions.go index 27d52524..f7aabfc5 100644 --- a/util/sprig/functions.go +++ b/util/sprig/functions.go @@ -24,22 +24,19 @@ const ( func TxtFuncMap() template.FuncMap { return map[string]any{ // Date functions - "ago": dateAgo, - "date": date, - "date_in_zone": dateInZone, - "date_modify": dateModify, - "dateInZone": dateInZone, - "dateModify": dateModify, - "duration": duration, - "durationRound": durationRound, - "htmlDate": htmlDate, - "htmlDateInZone": htmlDateInZone, - "must_date_modify": mustDateModify, - "mustDateModify": mustDateModify, - "mustToDate": mustToDate, - "now": time.Now, - "toDate": toDate, - "unixEpoch": unixEpoch, + "ago": dateAgo, + "date": date, + "dateInZone": dateInZone, + "dateModify": dateModify, + "duration": duration, + "durationRound": durationRound, + "htmlDate": htmlDate, + "htmlDateInZone": htmlDateInZone, + "mustDateModify": mustDateModify, + "mustToDate": mustToDate, + "now": time.Now, + "toDate": toDate, + "unixEpoch": unixEpoch, // Strings "trunc": trunc,