Skip to content

Commit ea00867

Browse files
authored
bump go to 1.25.10 and libs (#73)
Signed-off-by: Fedor Partanskiy <fredprtnsk@gmail.com>
1 parent 8d29ca6 commit ea00867

14 files changed

Lines changed: 148 additions & 172 deletions

File tree

.github/workflows/build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ on:
1515
env:
1616
GOPATH: /opt/go
1717
PATH: /opt/go/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin
18-
GO_VER: 1.21.9
18+
GO_VER: 1.25.10
1919

2020
jobs:
2121
unit-tests:

ci/install-tools.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,4 @@ set -euo pipefail
88

99
cd "$(dirname "$0")/tools"
1010
export GO111MODULE=on
11-
go install -tags tools golang.org/x/lint/golint
12-
go install -tags tools golang.org/x/tools/cmd/goimports
13-
go install -tags tools mvdan.cc/gofumpt
11+
go install tool

ci/lint.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ fi
2323

2424
## Formatting
2525
echo "running gofumpt..."
26-
gofumpt_output="$(gofumpt -l -s "${go_files[@]}")"
26+
gofumpt_output="$(gofumpt -l "${go_files[@]}")"
2727
if [ -n "$gofumpt_output" ]; then
2828
echo "The following files contain gofumpt errors:"
2929
echo "$gofumpt_output"
30-
echo "Please run 'gofumpt -s -w' for these files."
30+
echo "Please run 'gofumpt -w' for these files."
3131
exit 1
3232
fi
3333

ci/tools/go.mod

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
11
module tools
22

3-
go 1.14
3+
go 1.25.10
4+
5+
tool (
6+
golang.org/x/lint/golint
7+
golang.org/x/tools/cmd/goimports
8+
mvdan.cc/gofumpt
9+
)
410

511
require (
6-
golang.org/x/lint v0.0.0-20200302205851-738671d3881b
7-
golang.org/x/tools v0.0.0-20210101214203-2dba1e4ea05c
8-
mvdan.cc/gofumpt v0.1.0
12+
golang.org/x/lint v0.0.0-20241112194109-818c5a804067 // indirect
13+
golang.org/x/mod v0.36.0 // indirect
14+
golang.org/x/sync v0.20.0 // indirect
15+
golang.org/x/sys v0.44.0 // indirect
16+
golang.org/x/telemetry v0.0.0-20260508192327-42602be52be6 // indirect
17+
golang.org/x/tools v0.45.0 // indirect
18+
mvdan.cc/gofumpt v0.10.0 // indirect
919
)

ci/tools/go.sum

Lines changed: 24 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,35 @@
1-
github.com/google/go-cmp v0.5.4 h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M=
2-
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
3-
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
4-
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
5-
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
6-
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
7-
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
8-
github.com/rogpeppe/go-internal v1.6.2 h1:aIihoIOHCiLZHxyoNQ+ABL4NKhFTgKLBdMLyEAh98m0=
9-
github.com/rogpeppe/go-internal v1.6.2/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
10-
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
1+
github.com/go-quicktest/qt v1.102.0 h1:HSQxCeh5YZH3EL3W39ixjtyaEhcWSXQHtHnMBzSs474=
2+
github.com/go-quicktest/qt v1.102.0/go.mod h1:p4lGIVX+8Wa6ZPNDvqcxq36XpUDLh42FLetFU7odllI=
3+
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
4+
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
5+
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
6+
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
7+
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
8+
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
9+
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
10+
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
1111
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
1212
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
13-
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
14-
golang.org/x/lint v0.0.0-20200302205851-738671d3881b h1:Wh+f8QHJXR411sJR8/vRBTZ7YapZaRvUcLFFJhusH0k=
15-
golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
13+
golang.org/x/lint v0.0.0-20241112194109-818c5a804067 h1:adDmSQyFTCiv19j015EGKJBoaa7ElV0Q1Wovb/4G7NA=
14+
golang.org/x/lint v0.0.0-20241112194109-818c5a804067/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
1615
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
17-
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
18-
golang.org/x/mod v0.4.0 h1:8pl+sMODzuvGJkmj2W4kZihvVb5mKm8pB/X44PIQHv8=
19-
golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
16+
golang.org/x/mod v0.36.0 h1:JJjpVx6myfUsUdAzZuOSTTmRE0PfZeNWzzvKrP7amb4=
17+
golang.org/x/mod v0.36.0/go.mod h1:moc6ELqsWcOw5Ef3xVprK5ul/MvtVvkIXLziUOICjUQ=
2018
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
2119
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
22-
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
2320
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
24-
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
21+
golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4=
22+
golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
2523
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
2624
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
27-
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
25+
golang.org/x/sys v0.44.0 h1:ildZl3J4uzeKP07r2F++Op7E9B29JRUy+a27EibtBTQ=
26+
golang.org/x/sys v0.44.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
27+
golang.org/x/telemetry v0.0.0-20260508192327-42602be52be6 h1:HjU6IWBiAgRIdAJ9/y1rwCn+UELEmwV+VsTLzj/W4sE=
28+
golang.org/x/telemetry v0.0.0-20260508192327-42602be52be6/go.mod h1:Eqhaxk/wZsWEH8CRxLwj6xzEJbz7k1EFGqx7nyCoabE=
2829
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
29-
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
30-
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
31-
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
3230
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
33-
golang.org/x/tools v0.0.0-20210101214203-2dba1e4ea05c h1:dS09fXwOFF9cXBnIzZexIuUBj95U1NyQjkEhkgidDow=
34-
golang.org/x/tools v0.0.0-20210101214203-2dba1e4ea05c/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
35-
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
31+
golang.org/x/tools v0.45.0 h1:18qN3FAooORvApf5XjCXgsuayZOEtXf6JK18I3+ONa8=
32+
golang.org/x/tools v0.45.0/go.mod h1:LuUGqqaXcXMEFEruIVJVm5mgDD8vww/z/SR1gQ4uE/0=
3633
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
37-
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
38-
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
39-
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
40-
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
41-
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
42-
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
43-
gopkg.in/errgo.v2 v2.1.0 h1:0vLT13EuvQ0hNvakwLuFZ/jYrLp5F3kcWHXdRggjCE8=
44-
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
45-
mvdan.cc/gofumpt v0.1.0 h1:hsVv+Y9UsZ/mFZTxJZuHVI6shSQCtzZ11h1JEFPAZLw=
46-
mvdan.cc/gofumpt v0.1.0/go.mod h1:yXG1r1WqZVKWbVRtBWKWX9+CxGYfA51nSomhM0woR48=
34+
mvdan.cc/gofumpt v0.10.0 h1:yGGpRS2pBN2OQIi7b21IXknJna7faPkFaVfHLrN6Euo=
35+
mvdan.cc/gofumpt v0.10.0/go.mod h1:sU2ElXHzOEmvoPqfutYG7uunlueR4K2T1JFml40SzP4=

ci/tools/tools.go

Lines changed: 0 additions & 14 deletions
This file was deleted.

configtx/application_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,8 @@ func TestNewApplicationGroupFailure(t *testing.T) {
175175
Type: SignaturePolicyType,
176176
}
177177
},
178-
expectedErr: "invalid signature policy rule: 'ANYY Readers': Cannot transition " +
179-
"token types from VARIABLE [ANYY] to VARIABLE [Readers]",
178+
expectedErr: "invalid signature policy rule: 'ANYY Readers': unexpected token Identifier(\"Readers\") " +
179+
"(1:6)\n | ANYY Readers\n | .....^",
180180
},
181181
{
182182
testName: "When ImplicitMetaPolicy type is unknown policy type",
@@ -200,7 +200,7 @@ func TestNewApplicationGroupFailure(t *testing.T) {
200200
tt.applicationMod(&application)
201201

202202
configGrp, err := newApplicationGroupTemplate(application)
203-
gt.Expect(err).To(MatchError(tt.expectedErr))
203+
gt.Expect(err).To(MatchError(ContainSubstring(tt.expectedErr)))
204204
gt.Expect(configGrp).To(BeNil())
205205
})
206206
}

configtx/config_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,8 +358,8 @@ func TestNewCreateChannelTxFailure(t *testing.T) {
358358
},
359359
channelID: "testchannel",
360360
err: errors.New("creating default config template: failed to create application group: " +
361-
"invalid signature policy rule: 'ANYY Readers': Cannot transition " +
362-
"token types from VARIABLE [ANYY] to VARIABLE [Readers]"),
361+
"invalid signature policy rule: 'ANYY Readers': unexpected token Identifier(\"Readers\") " +
362+
"(1:6)\n | ANYY Readers\n | .....^"),
363363
},
364364
{
365365
testName: "When creating the default config template with an unknown policy type fails",

configtx/example_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,8 @@ func Example_policies() {
224224
configtx.Policy{
225225
Type: configtx.ImplicitMetaPolicyType,
226226
Rule: "MAJORITY Endorsement",
227-
})
227+
},
228+
)
228229
if err != nil {
229230
panic(err)
230231
}
@@ -247,7 +248,8 @@ func Example_policies() {
247248
configtx.Policy{
248249
Type: configtx.ImplicitMetaPolicyType,
249250
Rule: "MAJORITY Endorsement",
250-
})
251+
},
252+
)
251253
if err != nil {
252254
panic(err)
253255
}

configtx/internal/policydsl/policyparser.go

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"strconv"
1414
"strings"
1515

16-
"github.com/Knetic/govaluate"
16+
"github.com/expr-lang/expr"
1717
cb "github.com/hyperledger/fabric-protos-go-apiv2/common"
1818
mb "github.com/hyperledger/fabric-protos-go-apiv2/msp"
1919
"google.golang.org/protobuf/proto"
@@ -138,6 +138,8 @@ func firstPass(args ...interface{}) (interface{}, error) {
138138
case float32:
139139
case float64:
140140
toret += strconv.Itoa(int(t))
141+
case int:
142+
toret += strconv.Itoa(t)
141143
default:
142144
return nil, fmt.Errorf("unexpected type %s", reflect.TypeOf(arg))
143145
}
@@ -167,6 +169,8 @@ func secondPass(args ...interface{}) (interface{}, error) {
167169
switch arg := args[1].(type) {
168170
case float64:
169171
t = int(arg)
172+
case int:
173+
t = arg
170174
default:
171175
return nil, fmt.Errorf("unrecognized type, expected a number, got %s", reflect.TypeOf(args[1]))
172176
}
@@ -277,24 +281,23 @@ func newContext() *context {
277281
// the required role
278282
func FromString(policy string) (*cb.SignaturePolicyEnvelope, error) {
279283
// first we translate the and/or business into outof gates
280-
intermediate, err := govaluate.NewEvaluableExpressionWithFunctions(
281-
policy, map[string]govaluate.ExpressionFunction{
282-
GateAnd: and,
283-
strings.ToLower(GateAnd): and,
284-
strings.ToUpper(GateAnd): and,
285-
GateOr: or,
286-
strings.ToLower(GateOr): or,
287-
strings.ToUpper(GateOr): or,
288-
GateOutOf: outof,
289-
strings.ToLower(GateOutOf): outof,
290-
strings.ToUpper(GateOutOf): outof,
291-
},
292-
)
284+
env := map[string]interface{}{
285+
GateAnd: and,
286+
strings.ToLower(GateAnd): and,
287+
strings.ToUpper(GateAnd): and,
288+
GateOr: or,
289+
strings.ToLower(GateOr): or,
290+
strings.ToUpper(GateOr): or,
291+
GateOutOf: outof,
292+
strings.ToLower(GateOutOf): outof,
293+
strings.ToUpper(GateOutOf): outof,
294+
}
295+
intermediate, err := expr.Compile(policy, expr.Env(env))
293296
if err != nil {
294297
return nil, err
295298
}
296299

297-
intermediateRes, err := intermediate.Evaluate(map[string]interface{}{})
300+
intermediateRes, err := expr.Run(intermediate, env)
298301
if err != nil {
299302
// attempt to produce a meaningful error
300303
if regexErr.MatchString(err.Error()) {
@@ -318,15 +321,14 @@ func FromString(policy string) (*cb.SignaturePolicyEnvelope, error) {
318321
// to user-implemented functions other than via arguments.
319322
// We need this argument because we need a global place where
320323
// we put the identities that the policy requires
321-
exp, err := govaluate.NewEvaluableExpressionWithFunctions(
322-
resStr,
323-
map[string]govaluate.ExpressionFunction{"outof": firstPass},
324-
)
324+
env = map[string]interface{}{
325+
"outof": firstPass,
326+
}
327+
exp, err := expr.Compile(resStr, expr.Env(env))
325328
if err != nil {
326329
return nil, err
327330
}
328-
329-
res, err := exp.Evaluate(map[string]interface{}{})
331+
res, err := expr.Run(exp, env)
330332
if err != nil {
331333
// attempt to produce a meaningful error
332334
if regexErr.MatchString(err.Error()) {
@@ -345,18 +347,16 @@ func FromString(policy string) (*cb.SignaturePolicyEnvelope, error) {
345347
}
346348

347349
ctx := newContext()
348-
parameters := make(map[string]interface{}, 1)
349-
parameters["ID"] = ctx
350-
351-
exp, err = govaluate.NewEvaluableExpressionWithFunctions(
352-
resStr,
353-
map[string]govaluate.ExpressionFunction{"outof": secondPass},
354-
)
350+
env = map[string]interface{}{
351+
"outof": secondPass,
352+
"ID": ctx,
353+
}
354+
exp, err = expr.Compile(resStr, expr.Env(env))
355355
if err != nil {
356356
return nil, err
357357
}
358358

359-
res, err = exp.Evaluate(parameters)
359+
res, err = expr.Run(exp, env)
360360
if err != nil {
361361
// attempt to produce a meaningful error
362362
if regexErr.MatchString(err.Error()) {

0 commit comments

Comments
 (0)