From 9241cb919e5db455be480ae8be531f48038ecd61 Mon Sep 17 00:00:00 2001 From: andig Date: Thu, 18 Apr 2024 08:37:14 +0200 Subject: [PATCH] chore: migrate to sprout (#13477) --- cmd/configure/configure.go | 4 ++-- cmd/dump.go | 4 ++-- cmd/eebus.go | 4 ++-- go.mod | 6 +----- go.sum | 18 ++---------------- push/hub.go | 6 +++--- util/format.go | 4 ++-- util/templates/documentation.go | 4 ++-- util/templates/template.go | 4 ++-- util/templates/utils.go | 4 ++-- 10 files changed, 20 insertions(+), 38 deletions(-) diff --git a/cmd/configure/configure.go b/cmd/configure/configure.go index b1b832d63..e824d4acc 100644 --- a/cmd/configure/configure.go +++ b/cmd/configure/configure.go @@ -5,7 +5,7 @@ import ( _ "embed" "text/template" - "github.com/Masterminds/sprig/v3" + "github.com/42atomys/sprout" "github.com/evcc-io/evcc/util/templates" ) @@ -116,7 +116,7 @@ var configTmpl string // RenderConfiguration creates a yaml configuration func (c *Configure) RenderConfiguration() ([]byte, error) { - tmpl, err := template.New("yaml").Funcs(sprig.TxtFuncMap()).Parse(configTmpl) + tmpl, err := template.New("yaml").Funcs(sprout.TxtFuncMap()).Parse(configTmpl) if err != nil { panic(err) } diff --git a/cmd/dump.go b/cmd/dump.go index 3a949d444..01ed3a60b 100644 --- a/cmd/dump.go +++ b/cmd/dump.go @@ -8,7 +8,7 @@ import ( "path/filepath" "text/template" - "github.com/Masterminds/sprig/v3" + "github.com/42atomys/sprout" "github.com/evcc-io/evcc/core" "github.com/evcc-io/evcc/server" "github.com/evcc-io/evcc/util/config" @@ -70,7 +70,7 @@ func runDump(cmd *cobra.Command, args []string) { tmpl := template.Must( template.New("dump"). - Funcs(sprig.TxtFuncMap()). + Funcs(sprout.TxtFuncMap()). Parse(dumpTmpl)) out := new(bytes.Buffer) diff --git a/cmd/eebus.go b/cmd/eebus.go index 6d551f6ac..a7940812b 100644 --- a/cmd/eebus.go +++ b/cmd/eebus.go @@ -4,7 +4,7 @@ import ( "os" "text/template" - "github.com/Masterminds/sprig/v3" + "github.com/42atomys/sprout" "github.com/evcc-io/evcc/charger/eebus" "github.com/spf13/cobra" ) @@ -42,7 +42,7 @@ func generateEEBUSCert() { log.FATAL.Fatal("could not process generated certificate", err) } - t := template.Must(template.New("out").Funcs(sprig.TxtFuncMap()).Parse(tmpl)) + t := template.Must(template.New("out").Funcs(sprout.TxtFuncMap()).Parse(tmpl)) if err := t.Execute(os.Stdout, map[string]interface{}{ "public": pubKey, "private": privKey, diff --git a/go.mod b/go.mod index 14434a03f..9334e3d29 100644 --- a/go.mod +++ b/go.mod @@ -4,9 +4,9 @@ go 1.22.0 require ( dario.cat/mergo v1.0.0 + github.com/42atomys/sprout v0.0.0-20240403003052-d64a48ef7bae github.com/AlecAivazis/survey/v2 v2.3.7 github.com/BurntSushi/toml v1.3.2 - github.com/Masterminds/sprig/v3 v3.2.3 github.com/PuerkitoBio/goquery v1.9.1 github.com/andig/go-powerwall v0.2.1-0.20230808194509-dd70cdb6e140 github.com/andig/gosunspec v0.0.0-20231205122018-1daccfa17912 @@ -104,7 +104,6 @@ require ( ) require ( - github.com/Masterminds/goutils v1.1.1 // indirect github.com/Masterminds/semver/v3 v3.2.1 // indirect github.com/ahmetb/go-linq/v3 v3.2.0 // indirect github.com/andybalholm/cascadia v1.3.2 // indirect @@ -136,7 +135,6 @@ require ( github.com/hashicorp/hcl v1.0.0 // indirect github.com/holoplot/go-avahi v1.0.1 // indirect github.com/huandu/xstrings v1.4.0 // indirect - github.com/imdario/mergo v1.0.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/influxdata/line-protocol v0.0.0-20210922203350-b1ad95c89adf // indirect github.com/insomniacslk/xjson v0.0.0-20240314172816-ab1449dc107f // indirect @@ -198,6 +196,4 @@ require ( modernc.org/sqlite v1.29.6 // indirect ) -replace github.com/imdario/mergo => github.com/imdario/mergo v0.3.16 - replace github.com/spf13/viper => github.com/spf13/viper v1.18.1 diff --git a/go.sum b/go.sum index b3370fa67..174426687 100644 --- a/go.sum +++ b/go.sum @@ -2,19 +2,16 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= +github.com/42atomys/sprout v0.0.0-20240403003052-d64a48ef7bae h1:997KCkMlF7NNKrEFn1uFyRKcLbxutBveYat1m6nF3E4= +github.com/42atomys/sprout v0.0.0-20240403003052-d64a48ef7bae/go.mod h1:nTr5KxiTLYrnmEiZaJLuD/Ct+xod3KpHBmqhaZjQ1Lk= github.com/AlecAivazis/survey/v2 v2.3.7 h1:6I/u8FvytdGsgonrYsVn2t8t4QiRnh6QSTqkkhIiSjQ= github.com/AlecAivazis/survey/v2 v2.3.7/go.mod h1:xUTIdE4KCOIjsBAE1JYsUPoCqYdZ1reCfTwbto0Fduo= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8= github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= -github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI= -github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= -github.com/Masterminds/semver/v3 v3.2.0/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= github.com/Masterminds/semver/v3 v3.2.1 h1:RN9w6+7QoMeJVGyfmbcgs28Br8cvmnucEXnY0rYXWg0= github.com/Masterminds/semver/v3 v3.2.1/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= -github.com/Masterminds/sprig/v3 v3.2.3 h1:eL2fZNezLomi0uOLqjQoN6BfsDD+fyLtgbJMAj9n6YA= -github.com/Masterminds/sprig/v3 v3.2.3/go.mod h1:rXcFaZ2zZbLRJv/xSysmlgIM1u11eBaRMhvYXJNkGuM= github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2 h1:+vx7roKuyA63nhn5WAunQHLTznkw5W8b1Xc0dNjp83s= github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2/go.mod h1:HBCaDeC1lPdgDeDbhX8XFpy1jqjK0IBG8W5K+xYqA0w= github.com/PuerkitoBio/goquery v1.9.1 h1:mTL6XjbJTZdpfL+Gwl5U2h1l9yEkJjhmlTeV9VPW7UI= @@ -309,12 +306,9 @@ github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec/go.mod h1:Q48J4R4Dvx github.com/holoplot/go-avahi v1.0.1 h1:XcqR2keL4qWRnlxHD5CAOdWpLFZJ+EOUK0vEuylfvvk= github.com/holoplot/go-avahi v1.0.1/go.mod h1:qH5psEKb0DK+BRplMfc+RY4VMOlbf6mqfxgpMy6aP0M= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/huandu/xstrings v1.3.3/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/huandu/xstrings v1.4.0 h1:D17IlohoQq4UcpqD7fDk80P7l+lwAmlFaBHgOipl2FU= github.com/huandu/xstrings v1.4.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= -github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4= -github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= @@ -426,7 +420,6 @@ github.com/miekg/dns v1.1.43/go.mod h1:+evo5L0630/F6ca/Z9+GAqzhjGyn8/c+TBaOyfEl0 github.com/miekg/dns v1.1.58 h1:ca2Hdkz+cDg/7eNF6V56jjzuZ4aCAE+DbVkILdQWG/4= github.com/miekg/dns v1.1.58/go.mod h1:Ypv+3b/KadlvW9vJfXOTf300O4UqaHFzFCuHz+rPkBY= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= -github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= @@ -439,7 +432,6 @@ github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:F github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/mlnoga/rct v0.1.2-0.20230731074838-03eacb926f99 h1:sX4VwA7zgImnMqRgEkzP+3oKCgUHRF0OvHghFJ0pntY= @@ -590,7 +582,6 @@ github.com/samber/lo v1.39.0 h1:4gTz1wUhNYLhFSKl6O+8peW0v2F4BCY034GRpU9WnuA= github.com/samber/lo v1.39.0/go.mod h1:+m/ZKRl6ClXCE2Lgf3MsQlWfh4bn1bz6CXEOxnEXnEA= github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= -github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k= github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= @@ -617,7 +608,6 @@ github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9yS github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= -github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= @@ -709,7 +699,6 @@ golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= golang.org/x/crypto/x509roots/fallback v0.0.0-20240404165943-d042a396a6de h1:C/4YHQ2Yo1mfk96afFDQ8hmky1PMCWwM9I96RB7GikA= @@ -755,7 +744,6 @@ golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96b golang.org/x/net v0.0.0-20210423184538-5f58ad60dda6/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= @@ -819,7 +807,6 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220804214406-8e32c043e418/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -827,7 +814,6 @@ golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY= golang.org/x/term v0.19.0 h1:+ThwsDv+tYfnJFhF4L8jITxu1tdTWRTZpdsWgEgjL6Q= diff --git a/push/hub.go b/push/hub.go index 410938828..9c5150eab 100644 --- a/push/hub.go +++ b/push/hub.go @@ -5,7 +5,7 @@ import ( "strings" "text/template" - "github.com/Masterminds/sprig/v3" + "github.com/42atomys/sprout" "github.com/evcc-io/evcc/core/vehicle" "github.com/evcc-io/evcc/util" ) @@ -38,10 +38,10 @@ type Hub struct { func NewHub(cc map[string]EventTemplateConfig, vv Vehicles, cache *util.Cache) (*Hub, error) { // instantiate all event templates for k, v := range cc { - if _, err := template.New("out").Funcs(sprig.TxtFuncMap()).Parse(v.Title); err != nil { + if _, err := template.New("out").Funcs(sprout.TxtFuncMap()).Parse(v.Title); err != nil { return nil, fmt.Errorf("invalid event title: %s (%w)", k, err) } - if _, err := template.New("out").Funcs(sprig.TxtFuncMap()).Parse(v.Msg); err != nil { + if _, err := template.New("out").Funcs(sprout.TxtFuncMap()).Parse(v.Msg); err != nil { return nil, fmt.Errorf("invalid event message: %s (%w)", k, err) } } diff --git a/util/format.go b/util/format.go index abcfea839..a92dfa903 100644 --- a/util/format.go +++ b/util/format.go @@ -8,7 +8,7 @@ import ( "strings" "time" - "github.com/Masterminds/sprig/v3" + "github.com/42atomys/sprout" ) var re = regexp.MustCompile(`\${(\w+)(:([a-zA-Z0-9%.]+))?}`) @@ -52,7 +52,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(sprout.FuncMap()). Funcs(map[string]any{ "timeRound": timeRound, }).Parse(s) diff --git a/util/templates/documentation.go b/util/templates/documentation.go index d7b881dbb..1e636008b 100644 --- a/util/templates/documentation.go +++ b/util/templates/documentation.go @@ -7,7 +7,7 @@ import ( "strings" "text/template" - "github.com/Masterminds/sprig/v3" + "github.com/42atomys/sprout" ) //go:embed documentation.tpl @@ -45,7 +45,7 @@ func (t *Template) RenderDocumentation(product Product, lang string) ([]byte, er var modbusRender string if modbusChoices := t.ModbusChoices(); len(modbusChoices) > 0 { if i, _ := t.ParamByName(ParamModbus); i > -1 { - modbusTmpl, err := template.New("yaml").Funcs(sprig.TxtFuncMap()).Parse(documentationModbusTmpl) + modbusTmpl, err := template.New("yaml").Funcs(sprout.TxtFuncMap()).Parse(documentationModbusTmpl) if err != nil { panic(err) } diff --git a/util/templates/template.go b/util/templates/template.go index a589d95f9..b3fbffddd 100644 --- a/util/templates/template.go +++ b/util/templates/template.go @@ -9,7 +9,7 @@ import ( "strings" "text/template" - "github.com/Masterminds/sprig/v3" + "github.com/42atomys/sprout" "github.com/evcc-io/evcc/util" ) @@ -208,7 +208,7 @@ var proxyTmpl string // RenderProxyWithValues renders the proxy template func (t *Template) RenderProxyWithValues(values map[string]interface{}, lang string) ([]byte, error) { - tmpl, err := template.New("yaml").Funcs(sprig.TxtFuncMap()).Parse(proxyTmpl) + tmpl, err := template.New("yaml").Funcs(sprout.TxtFuncMap()).Parse(proxyTmpl) if err != nil { panic(err) } diff --git a/util/templates/utils.go b/util/templates/utils.go index cb9f2cd72..51d008264 100644 --- a/util/templates/utils.go +++ b/util/templates/utils.go @@ -8,7 +8,7 @@ import ( "text/template" "time" - "github.com/Masterminds/sprig/v3" + "github.com/42atomys/sprout" "gopkg.in/yaml.v3" ) @@ -67,5 +67,5 @@ func FuncMap(tmpl *template.Template) *template.Template { }, } - return tmpl.Funcs(sprig.TxtFuncMap()).Funcs(funcMap) + return tmpl.Funcs(sprout.TxtFuncMap()).Funcs(funcMap) }