Skip to content

Commit e312211

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

16 files changed

Lines changed: 132 additions & 102 deletions

File tree

.github/workflows/test.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@ jobs:
1313
- uses: actions/checkout@v4
1414
- uses: actions/setup-go@v5
1515
with:
16-
go-version: "1.21"
16+
go-version: "1.25.10"
1717
- name: Staticcheck
1818
run: make staticcheck
1919
- name: golangci-lint
20-
uses: golangci/golangci-lint-action@v6
20+
uses: golangci/golangci-lint-action@v9
2121
with:
22-
version: latest
22+
version: v2.9.0
23+
skip-cache: true
24+
problem-matchers: true
2325
- name: Unit test
2426
run: make unit-test

.golangci.yml

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,26 @@
11
# See https://golangci-lint.run/usage/configuration/
2-
2+
version: "2"
33
run:
44
timeout: 5m
5+
concurrency: 4
6+
go: "1.25"
57

68
linters:
7-
disable-all: true
9+
default: none
810
enable:
9-
- errcheck
10-
- gofmt
11-
- goimports
1211
- gosec
13-
- gosimple
12+
- staticcheck
1413
- govet
1514
- ineffassign
1615
- misspell
17-
- typecheck
1816
- unused
19-
linters-settings:
20-
gosec:
21-
excludes:
22-
- 'G115' # safe to exclude type conversion overflow checks in this repository since the integer values will always be low
17+
settings:
18+
gosec:
19+
excludes:
20+
- G115 # safe to exclude type conversion overflow checks in this repository since the integer values will always be low
21+
formatters:
22+
enable:
23+
- gci
24+
- gofmt
25+
- gofumpt
26+
- goimports

go.mod

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
module github.com/hyperledger/fabric-chaincode-go/v2
22

3-
go 1.24.0
3+
go 1.25.10
44

55
require (
66
github.com/hyperledger/fabric-protos-go-apiv2 v0.3.7
77
github.com/stretchr/testify v1.11.1
8-
google.golang.org/grpc v1.80.0
8+
google.golang.org/grpc v1.81.1
99
google.golang.org/protobuf v1.36.11
1010
)
1111

1212
require (
1313
github.com/davecgh/go-spew v1.1.1 // indirect
1414
github.com/kr/text v0.2.0 // indirect
1515
github.com/pmezard/go-difflib v1.0.0 // indirect
16-
golang.org/x/net v0.49.0 // indirect
17-
golang.org/x/sys v0.40.0 // indirect
18-
golang.org/x/text v0.33.0 // indirect
19-
google.golang.org/genproto/googleapis/rpc v0.0.0-20260120221211-b8f7ae30c516 // indirect
16+
golang.org/x/net v0.54.0 // indirect
17+
golang.org/x/sys v0.44.0 // indirect
18+
golang.org/x/text v0.37.0 // indirect
19+
google.golang.org/genproto/googleapis/rpc v0.0.0-20260511170946-3700d4141b60 // indirect
2020
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
2121
gopkg.in/yaml.v3 v3.0.1 // indirect
2222
)

go.sum

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -27,28 +27,28 @@ github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu
2727
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
2828
go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64=
2929
go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=
30-
go.opentelemetry.io/otel v1.39.0 h1:8yPrr/S0ND9QEfTfdP9V+SiwT4E0G7Y5MO7p85nis48=
31-
go.opentelemetry.io/otel v1.39.0/go.mod h1:kLlFTywNWrFyEdH0oj2xK0bFYZtHRYUdv1NklR/tgc8=
32-
go.opentelemetry.io/otel/metric v1.39.0 h1:d1UzonvEZriVfpNKEVmHXbdf909uGTOQjA0HF0Ls5Q0=
33-
go.opentelemetry.io/otel/metric v1.39.0/go.mod h1:jrZSWL33sD7bBxg1xjrqyDjnuzTUB0x1nBERXd7Ftcs=
34-
go.opentelemetry.io/otel/sdk v1.39.0 h1:nMLYcjVsvdui1B/4FRkwjzoRVsMK8uL/cj0OyhKzt18=
35-
go.opentelemetry.io/otel/sdk v1.39.0/go.mod h1:vDojkC4/jsTJsE+kh+LXYQlbL8CgrEcwmt1ENZszdJE=
36-
go.opentelemetry.io/otel/sdk/metric v1.39.0 h1:cXMVVFVgsIf2YL6QkRF4Urbr/aMInf+2WKg+sEJTtB8=
37-
go.opentelemetry.io/otel/sdk/metric v1.39.0/go.mod h1:xq9HEVH7qeX69/JnwEfp6fVq5wosJsY1mt4lLfYdVew=
38-
go.opentelemetry.io/otel/trace v1.39.0 h1:2d2vfpEDmCJ5zVYz7ijaJdOF59xLomrvj7bjt6/qCJI=
39-
go.opentelemetry.io/otel/trace v1.39.0/go.mod h1:88w4/PnZSazkGzz/w84VHpQafiU4EtqqlVdxWy+rNOA=
40-
golang.org/x/net v0.49.0 h1:eeHFmOGUTtaaPSGNmjBKpbng9MulQsJURQUAfUwY++o=
41-
golang.org/x/net v0.49.0/go.mod h1:/ysNB2EvaqvesRkuLAyjI1ycPZlQHM3q01F02UY/MV8=
42-
golang.org/x/sys v0.40.0 h1:DBZZqJ2Rkml6QMQsZywtnjnnGvHza6BTfYFWY9kjEWQ=
43-
golang.org/x/sys v0.40.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
44-
golang.org/x/text v0.33.0 h1:B3njUFyqtHDUI5jMn1YIr5B0IE2U0qck04r6d4KPAxE=
45-
golang.org/x/text v0.33.0/go.mod h1:LuMebE6+rBincTi9+xWTY8TztLzKHc/9C1uBCG27+q8=
30+
go.opentelemetry.io/otel v1.43.0 h1:mYIM03dnh5zfN7HautFE4ieIig9amkNANT+xcVxAj9I=
31+
go.opentelemetry.io/otel v1.43.0/go.mod h1:JuG+u74mvjvcm8vj8pI5XiHy1zDeoCS2LB1spIq7Ay0=
32+
go.opentelemetry.io/otel/metric v1.43.0 h1:d7638QeInOnuwOONPp4JAOGfbCEpYb+K6DVWvdxGzgM=
33+
go.opentelemetry.io/otel/metric v1.43.0/go.mod h1:RDnPtIxvqlgO8GRW18W6Z/4P462ldprJtfxHxyKd2PY=
34+
go.opentelemetry.io/otel/sdk v1.43.0 h1:pi5mE86i5rTeLXqoF/hhiBtUNcrAGHLKQdhg4h4V9Dg=
35+
go.opentelemetry.io/otel/sdk v1.43.0/go.mod h1:P+IkVU3iWukmiit/Yf9AWvpyRDlUeBaRg6Y+C58QHzg=
36+
go.opentelemetry.io/otel/sdk/metric v1.43.0 h1:S88dyqXjJkuBNLeMcVPRFXpRw2fuwdvfCGLEo89fDkw=
37+
go.opentelemetry.io/otel/sdk/metric v1.43.0/go.mod h1:C/RJtwSEJ5hzTiUz5pXF1kILHStzb9zFlIEe85bhj6A=
38+
go.opentelemetry.io/otel/trace v1.43.0 h1:BkNrHpup+4k4w+ZZ86CZoHHEkohws8AY+WTX09nk+3A=
39+
go.opentelemetry.io/otel/trace v1.43.0/go.mod h1:/QJhyVBUUswCphDVxq+8mld+AvhXZLhe+8WVFxiFff0=
40+
golang.org/x/net v0.54.0 h1:2zJIZAxAHV/OHCDTCOHAYehQzLfSXuf/5SoL/Dv6w/w=
41+
golang.org/x/net v0.54.0/go.mod h1:Sj4oj8jK6XmHpBZU/zWHw3BV3abl4Kvi+Ut7cQcY+cQ=
42+
golang.org/x/sys v0.44.0 h1:ildZl3J4uzeKP07r2F++Op7E9B29JRUy+a27EibtBTQ=
43+
golang.org/x/sys v0.44.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
44+
golang.org/x/text v0.37.0 h1:Cqjiwd9eSg8e0QAkyCaQTNHFIIzWtidPahFWR83rTrc=
45+
golang.org/x/text v0.37.0/go.mod h1:a5sjxXGs9hsn/AJVwuElvCAo9v8QYLzvavO5z2PiM38=
4646
gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4=
4747
gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E=
48-
google.golang.org/genproto/googleapis/rpc v0.0.0-20260120221211-b8f7ae30c516 h1:sNrWoksmOyF5bvJUcnmbeAmQi8baNhqg5IWaI3llQqU=
49-
google.golang.org/genproto/googleapis/rpc v0.0.0-20260120221211-b8f7ae30c516/go.mod h1:j9x/tPzZkyxcgEFkiKEEGxfvyumM01BEtsW8xzOahRQ=
50-
google.golang.org/grpc v1.80.0 h1:Xr6m2WmWZLETvUNvIUmeD5OAagMw3FiKmMlTdViWsHM=
51-
google.golang.org/grpc v1.80.0/go.mod h1:ho/dLnxwi3EDJA4Zghp7k2Ec1+c2jqup0bFkw07bwF4=
48+
google.golang.org/genproto/googleapis/rpc v0.0.0-20260511170946-3700d4141b60 h1:seT2EwLWM78plQ7wcDfuWBc/4FAEAXDDiaSol4ku4qo=
49+
google.golang.org/genproto/googleapis/rpc v0.0.0-20260511170946-3700d4141b60/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8=
50+
google.golang.org/grpc v1.81.1 h1:VnnIIZ88UzOOKLukQi+ImGz8O1Wdp8nAGGnvOfEIWQQ=
51+
google.golang.org/grpc v1.81.1/go.mod h1:xGH9GfzOyMTGIOXBJmXt+BX/V0kcdQbdcuwQ/zNw42I=
5252
google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE=
5353
google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
5454
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

pkg/cid/cid_test.go

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ KoZIzj0EAwIDRwAwRAIgCoXaCdU8ZiRKkai0QiXJM/GL5fysLnmG2oZ6XOIdwtsC
2929
IEmCsI8Mhrvx1doTbEOm7kmIrhQwUVDBNXCWX1t3kJVN
3030
-----END CERTIFICATE-----
3131
`
32+
3233
const certWithAttrs = `-----BEGIN CERTIFICATE-----
3334
MIIB6TCCAY+gAwIBAgIUHkmY6fRP0ANTvzaBwKCkMZZPUnUwCgYIKoZIzj0EAwIw
3435
GzEZMBcGA1UEAxMQZmFicmljLWNhLXNlcnZlcjAeFw0xNzA5MDgwMzQyMDBaFw0x
@@ -133,8 +134,10 @@ func TestIdemix(t *testing.T) {
133134

134135
func getMockStub() (cid.ChaincodeStubInterface, error) {
135136
stub := &mockStub{}
136-
sid := &msp.SerializedIdentity{Mspid: "SampleOrg",
137-
IdBytes: []byte(certWithOutAttrs)}
137+
sid := &msp.SerializedIdentity{
138+
Mspid: "SampleOrg",
139+
IdBytes: []byte(certWithOutAttrs),
140+
}
138141
b, err := proto.Marshal(sid)
139142
if err != nil {
140143
return nil, err
@@ -145,8 +148,10 @@ func getMockStub() (cid.ChaincodeStubInterface, error) {
145148

146149
func getMockStubWithAttrs() (cid.ChaincodeStubInterface, error) {
147150
stub := &mockStub{}
148-
sid := &msp.SerializedIdentity{Mspid: "SampleOrg",
149-
IdBytes: []byte(certWithAttrs)}
151+
sid := &msp.SerializedIdentity{
152+
Mspid: "SampleOrg",
153+
IdBytes: []byte(certWithAttrs),
154+
}
150155
b, err := proto.Marshal(sid)
151156
if err != nil {
152157
return nil, err
@@ -161,7 +166,8 @@ func getIdemixMockStubWithAttrs() (cid.ChaincodeStubInterface, error) {
161166
if err != nil {
162167
return nil, err
163168
}
164-
sid := &msp.SerializedIdentity{Mspid: "idemixOrg",
169+
sid := &msp.SerializedIdentity{
170+
Mspid: "idemixOrg",
165171
IdBytes: idBytes,
166172
}
167173
b, err := proto.Marshal(sid)

pkg/cid/interfaces.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ type ChaincodeStubInterface interface {
1717
// ClientIdentity represents information about the identity that submitted the
1818
// transaction
1919
type ClientIdentity interface {
20-
2120
// GetID returns the ID associated with the invoking identity. This ID
2221
// is guaranteed to be unique within the MSP.
2322
GetID() (string, error)

shim/handler.go

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -548,8 +548,12 @@ func (h *Handler) sendBatch(channelID string, txid string, writes []*peer.WriteR
548548
return nil
549549
}
550550

551-
func (h *Handler) handleGetStateByRange(collection, startKey, endKey string, metadata []byte,
552-
channelID string, txid string) (*peer.QueryResponse, error) {
551+
func (h *Handler) handleGetStateByRange(
552+
collection, startKey, endKey string,
553+
metadata []byte,
554+
channelID string,
555+
txid string,
556+
) (*peer.QueryResponse, error) {
553557
// Send GET_STATE_BY_RANGE message to peer chaincode support
554558
payloadBytes := marshalOrPanic(&peer.GetStateByRange{Collection: collection, StartKey: startKey, EndKey: endKey, Metadata: metadata})
555559
msg := &peer.ChaincodeMessage{Type: peer.ChaincodeMessage_GET_STATE_BY_RANGE, Payload: payloadBytes, Txid: txid, ChannelId: channelID}
@@ -651,8 +655,13 @@ func (h *Handler) handleQueryStateClose(id, channelID, txid string) (*peer.Query
651655
return nil, fmt.Errorf("incorrect chaincode message %s received. Expecting %s or %s", responseMsg.Type, peer.ChaincodeMessage_RESPONSE, peer.ChaincodeMessage_ERROR)
652656
}
653657

654-
func (h *Handler) handleGetQueryResult(collection string, query string, metadata []byte,
655-
channelID string, txid string) (*peer.QueryResponse, error) {
658+
func (h *Handler) handleGetQueryResult(
659+
collection string,
660+
query string,
661+
metadata []byte,
662+
channelID string,
663+
txid string,
664+
) (*peer.QueryResponse, error) {
656665
// Send GET_QUERY_RESULT message to peer chaincode support
657666
payloadBytes := marshalOrPanic(&peer.GetQueryResult{Collection: collection, Query: query, Metadata: metadata})
658667
msg := &peer.ChaincodeMessage{Type: peer.ChaincodeMessage_GET_QUERY_RESULT, Payload: payloadBytes, Txid: txid, ChannelId: channelID}
@@ -853,7 +862,7 @@ func (h *Handler) handleMessage(msg *peer.ChaincodeMessage, errc chan error) err
853862
if err != nil {
854863
payload := []byte(err.Error())
855864
errorMsg := &peer.ChaincodeMessage{Type: peer.ChaincodeMessage_ERROR, Payload: payload, Txid: msg.Txid}
856-
h.serialSend(errorMsg) //nolint:errcheck
865+
h.serialSend(errorMsg) //nolint:gosec
857866
return err
858867
}
859868

shim/handler_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func TestNewHandler_CreatedState(t *testing.T) {
6060
func TestHandlerState(t *testing.T) {
6161
t.Parallel()
6262

63-
var tests = []struct {
63+
tests := []struct {
6464
name string
6565
state state
6666
msg *peer.ChaincodeMessage
@@ -135,7 +135,7 @@ func TestHandlerState(t *testing.T) {
135135
func TestHandleMessage(t *testing.T) {
136136
t.Parallel()
137137

138-
var tests = []struct {
138+
tests := []struct {
139139
name string
140140
msg *peer.ChaincodeMessage
141141
msgType peer.ChaincodeMessage_Type
@@ -294,5 +294,4 @@ func TestHandlePeerCalls(t *testing.T) {
294294

295295
_, err = h.handleGetHistoryForKey("key", "channel", "txid")
296296
assert.ErrorContains(t, err, "cannot create response channel")
297-
298297
}

shim/internal/client.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ func NewClientConn(
2727
tlsConf *tls.Config,
2828
kaOpts keepalive.ClientParameters,
2929
) (*grpc.ClientConn, error) {
30-
3130
dialOpts := []grpc.DialOption{
3231
grpc.WithKeepaliveParams(kaOpts),
3332
grpc.WithDefaultCallOptions(

shim/internal/config.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func LoadConfig() (Config, error) {
4848
var key []byte
4949
path, set := os.LookupEnv("CORE_TLS_CLIENT_KEY_FILE")
5050
if set {
51-
key, err = os.ReadFile(path)
51+
key, err = os.ReadFile(path) //nolint:gosec
5252
if err != nil {
5353
return Config{}, fmt.Errorf("failed to read private key file: %s", err)
5454
}
@@ -66,7 +66,7 @@ func LoadConfig() (Config, error) {
6666
var cert []byte
6767
path, set = os.LookupEnv("CORE_TLS_CLIENT_CERT_FILE")
6868
if set {
69-
cert, err = os.ReadFile(path)
69+
cert, err = os.ReadFile(path) //nolint:gosec
7070
if err != nil {
7171
return Config{}, fmt.Errorf("failed to read public key file: %s", err)
7272
}
@@ -132,7 +132,8 @@ func LoadTLSConfig(isserver bool, key, cert, root []byte) (*tls.Config, error) {
132132
if isserver {
133133
tlscfg.ClientCAs = rootCertPool
134134
tlscfg.SessionTicketsDisabled = true
135-
tlscfg.CipherSuites = []uint16{tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
135+
tlscfg.CipherSuites = []uint16{
136+
tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
136137
tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
137138
tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
138139
tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,

0 commit comments

Comments
 (0)