go.d sd fix sprig funcmap (#18658)
Ilya Mashchenko committed
Oct 2, 2024 at 11:30 UTC
c75e5140a9d191d1dab4ee0ab930a5e7242edaf1
1 file changed
+4
-4
src/go/plugin/go.d/agent/discovery/sd/pipeline/funcmap.go
+4
-4
@@ -14,7 +14,9 @@ import (
14
)
15
16
func newFuncMap() template.FuncMap {
17
- custom := map[string]any{
17
+ fm := sprig.TxtFuncMap()
18
+
19
+ extra := map[string]any{
20
"match": funcMatchAny,
21
"glob": func(value, pattern string, patterns ...string) bool {
22
return funcMatchAny("glob", value, pattern, patterns...)
@@ -25,9 +27,7 @@ func newFuncMap() template.FuncMap {
27
},
28
}
29
28
- fm := sprig.HermeticTxtFuncMap()
29
-
30
- for name, fn := range custom {
30
+ for name, fn := range extra {
31
fm[name] = fn
32
}
33