Skip to content

Commit 84623a4

Browse files
wanghong230sarabala1979
authored andcommitted
fix: upgrade sprig to v3.2.2 (argoproj#6876)
Signed-off-by: Hong Wang <[email protected]>
1 parent a29495b commit 84623a4

File tree

4 files changed

+22
-2
lines changed

4 files changed

+22
-2
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.16
55
require (
66
cloud.google.com/go/storage v1.10.0
77
github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible
8-
github.com/Masterminds/sprig v2.22.0+incompatible
8+
github.com/Masterminds/sprig/v3 v3.2.2
99
github.com/TwinProduction/go-color v0.0.3
1010
github.com/aliyun/aliyun-oss-go-sdk v2.1.8+incompatible
1111
github.com/antonmedv/expr v1.8.9

go.sum

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,13 @@ github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJ
106106
github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=
107107
github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww=
108108
github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y=
109+
github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030IGemrRc=
109110
github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs=
110111
github.com/Masterminds/sprig v2.22.0+incompatible h1:z4yfnGrZ7netVz+0EDJ0Wi+5VZCSYp4Z0m2dk6cEM60=
111112
github.com/Masterminds/sprig v2.22.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o=
112113
github.com/Masterminds/sprig/v3 v3.2.0/go.mod h1:tWhwTbUTndesPNeF0C900vKoq283u6zp4APT9vaF3SI=
114+
github.com/Masterminds/sprig/v3 v3.2.2 h1:17jRggJu518dr3QaafizSXOjKYp94wKfABxUmyxvxX8=
115+
github.com/Masterminds/sprig/v3 v3.2.2/go.mod h1:UoaO7Yp8KlPnJIYWTFkMaqPUYKTfGFPhxNuwnnxkKlk=
113116
github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA=
114117
github.com/Microsoft/go-winio v0.4.16 h1:FtSW/jqD+l4ba5iPBj9CODVtgfYAD8w2wS923g/cFDk=
115118
github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0=
@@ -1016,6 +1019,7 @@ github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg
10161019
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
10171020
github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
10181021
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
1022+
github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ=
10191023
github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
10201024
github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=
10211025
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=

util/expr/env/env.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package env
33
import (
44
"encoding/json"
55

6-
"github.com/Masterminds/sprig"
6+
sprig "github.com/Masterminds/sprig/v3"
77
exprpkg "github.com/argoproj/pkg/expr"
88

99
"github.com/argoproj/argo-workflows/v3/util/expand"

util/template/replace_test.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,19 @@ func TestReplaceStringWithWhiteSpace(t *testing.T) {
130130
assert.Equal(t, toJsonString("hello world"), replacement)
131131
}
132132
}
133+
134+
func TestReplaceStringWithExpression(t *testing.T) {
135+
replaceMap := map[string]string{"inputs.parameters.message": "hello world"}
136+
137+
test := toJsonString(`test {{= sprig.trunc(5, inputs.parameters.message) }}`)
138+
replacement, err := Replace(test, replaceMap, true)
139+
if assert.NoError(t, err) {
140+
assert.Equal(t, toJsonString("test hello"), replacement)
141+
}
142+
143+
test = toJsonString(`test {{= sprig.trunc(-5, inputs.parameters.message) }}`)
144+
replacement, err = Replace(test, replaceMap, true)
145+
if assert.NoError(t, err) {
146+
assert.Equal(t, toJsonString("test world"), replacement)
147+
}
148+
}

0 commit comments

Comments
 (0)