diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cc4618888a..36f75ccccf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,7 +32,7 @@ jobs: steps: - uses: actions/setup-go@v5 with: - go-version: "1.21" + go-version: "1.23.2" stable: true check-latest: true @@ -67,7 +67,7 @@ jobs: steps: - uses: actions/setup-go@v5 with: - go-version: "1.21" + go-version: "1.23.2" stable: true check-latest: true diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index ae2a166c2d..d1f293c730 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -25,7 +25,7 @@ jobs: - uses: actions/setup-go@v5 with: - go-version: "1.21" + go-version: "1.23.2" stable: true check-latest: true diff --git a/.github/workflows/copyright.yml b/.github/workflows/copyright.yml index 021bed83ee..baea62ded7 100644 --- a/.github/workflows/copyright.yml +++ b/.github/workflows/copyright.yml @@ -23,7 +23,7 @@ jobs: - uses: actions/setup-go@v5 with: - go-version: "1.21" + go-version: "1.23.2" stable: true check-latest: true diff --git a/.github/workflows/devnet.yml b/.github/workflows/devnet.yml index 5be40215f0..a0050d97b9 100644 --- a/.github/workflows/devnet.yml +++ b/.github/workflows/devnet.yml @@ -17,7 +17,7 @@ jobs: - uses: actions/setup-go@v5 with: - go-version: "1.21" + go-version: "1.23.2" stable: true check-latest: true diff --git a/.github/workflows/fuzz.yml b/.github/workflows/fuzz.yml index cdf5093286..3087cbdff7 100644 --- a/.github/workflows/fuzz.yml +++ b/.github/workflows/fuzz.yml @@ -14,7 +14,7 @@ jobs: - uses: actions/setup-go@v5 with: - go-version: "1.21" + go-version: "1.23.2" stable: true check-latest: true diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index aced03b145..4a90e2427a 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -45,7 +45,7 @@ jobs: - uses: actions/setup-go@v5 with: - go-version: "1.21" + go-version: "1.23.2" stable: true check-latest: true diff --git a/.github/workflows/mocks.yml b/.github/workflows/mocks.yml index 45b5cc28e4..25146340e9 100644 --- a/.github/workflows/mocks.yml +++ b/.github/workflows/mocks.yml @@ -22,7 +22,7 @@ jobs: - uses: actions/setup-go@v5 with: - go-version: "1.21" + go-version: "1.23.2" stable: true check-latest: true diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 0a20d96f54..56f59e876d 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -29,7 +29,7 @@ jobs: - uses: actions/setup-go@v5 with: - go-version: "1.21" + go-version: "1.23.2" stable: true check-latest: true diff --git a/.github/workflows/zombienet.yml b/.github/workflows/zombienet.yml index 21b1bd149f..e58d5d260b 100644 --- a/.github/workflows/zombienet.yml +++ b/.github/workflows/zombienet.yml @@ -9,7 +9,7 @@ jobs: steps: - uses: actions/setup-go@v5 with: - go-version: "1.21" + go-version: "1.23.2" stable: true check-latest: true diff --git a/.golangci.yml b/.golangci.yml index 8f4967776a..22d7626b66 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -6,14 +6,12 @@ run: build-tags: - integration - skip-files: - - .*mock_.*\.go - - .*mocks\/.*\.go - linters-settings: govet: # report about shadowed variables - check-shadowing: true + shadow: true + excludes: + - printf revive: severity: warning @@ -33,6 +31,17 @@ linters-settings: - map - chan + gosec: + excludes: + - G115 + - G301 + - G306 + + gosimple: + excludes: + - S1009 + + misspell: locale: UK ignore-words: @@ -41,12 +50,12 @@ linters-settings: - finalized - finalize - initialize + - color linters: enable: - bodyclose - errcheck - - exportloopref - goconst - gocyclo - gofmt @@ -68,8 +77,13 @@ linters: - unparam - usestdlibvars - unused + disable: + - typecheck issues: + exclude-files: + - .*mock_.*\.go + - .*mocks\/.*\.go exclude-rules: - path: _test\.go linters: @@ -95,6 +109,14 @@ issues: linters: - govet + - text: 'printf: non-constant format*' + linters: + - govet + + - text: 'return both a `nil` error and an invalid value*' + linters: + - nilnil + - linters: - revive text: "package comment should be of the form" diff --git a/Dockerfile b/Dockerfile index c0f90e6b8b..db0dac33d6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ ARG DEBIAN_VERSION=bullseye-slim -ARG GO_VERSION=1.21.1-bullseye +ARG GO_VERSION=1.23.2-bullseye FROM golang:${GO_VERSION} AS builder diff --git a/Dockerfile.staging b/Dockerfile.staging index ded6ef723d..eacc5e6a8c 100644 --- a/Dockerfile.staging +++ b/Dockerfile.staging @@ -1,4 +1,4 @@ -FROM golang:1.22 +FROM golang:1.23 ARG chain="polkadot" ARG basepath="~/.local/share/gossamer" diff --git a/Makefile b/Makefile index bf1478e768..21a8b6bbf9 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ help: Makefile .PHONY: lint lint: - go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.54 + go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.62 golangci-lint run clean: diff --git a/devnet/alice.Dockerfile b/devnet/alice.Dockerfile index fca629d5cb..28c3aec215 100644 --- a/devnet/alice.Dockerfile +++ b/devnet/alice.Dockerfile @@ -1,7 +1,7 @@ # Copyright 2021 ChainSafe Systems (ON) # SPDX-License-Identifier: LGPL-3.0-only -FROM golang:1.20 +FROM golang:1.23 ARG DD_API_KEY=somekey ARG CHAIN=westend-local diff --git a/devnet/bob.Dockerfile b/devnet/bob.Dockerfile index 5b4dff4c27..b8babd3f7b 100644 --- a/devnet/bob.Dockerfile +++ b/devnet/bob.Dockerfile @@ -1,7 +1,7 @@ # Copyright 2021 ChainSafe Systems (ON) # SPDX-License-Identifier: LGPL-3.0-only -FROM golang:1.20 +FROM golang:1.23 ARG DD_API_KEY=somekey ARG CHAIN=westend-local diff --git a/devnet/substrate_alice.Dockerfile b/devnet/substrate_alice.Dockerfile index c85c007dcd..82dec1a033 100644 --- a/devnet/substrate_alice.Dockerfile +++ b/devnet/substrate_alice.Dockerfile @@ -3,7 +3,7 @@ ARG POLKADOT_VERSION=v0.9.37 -FROM golang:1.20 as openmetrics +FROM golang:1.23 as openmetrics ARG METRICS_NAMESPACE=substrate.local.devnet WORKDIR /devnet diff --git a/devnet/substrate_bob.Dockerfile b/devnet/substrate_bob.Dockerfile index 8d4e680c69..2b966f11d5 100644 --- a/devnet/substrate_bob.Dockerfile +++ b/devnet/substrate_bob.Dockerfile @@ -3,7 +3,7 @@ ARG POLKADOT_VERSION=v0.9.37 -FROM golang:1.20 as openmetrics +FROM golang:1.23 as openmetrics ARG METRICS_NAMESPACE=substrate.local.devnet diff --git a/dot/parachain/backing/per_relay_parent_state.go b/dot/parachain/backing/per_relay_parent_state.go index bf206aa861..53360016a0 100644 --- a/dot/parachain/backing/per_relay_parent_state.go +++ b/dot/parachain/backing/per_relay_parent_state.go @@ -362,7 +362,7 @@ func (rpState *perRelayParentState) validateAndMakeAvailable( bgValidationResult = backgroundValidationResult{ outputs: nil, candidate: &candidateReceipt, - err: fmt.Errorf(validationResultRes.Data.Invalid.Error()), + err: validationResultRes.Data.Invalid, } } diff --git a/go.mod b/go.mod index f585b2c749..1ab95fa04d 100644 --- a/go.mod +++ b/go.mod @@ -200,7 +200,9 @@ require ( lukechampine.com/blake3 v1.2.1 // indirect ) -go 1.21 +go 1.23 + +toolchain go1.23.2 replace github.com/tetratelabs/wazero => github.com/ChainSafe/wazero v0.0.0-20240319130522-78b21a59bd5f diff --git a/internal/log/level.go b/internal/log/level.go index 7531c7a421..169127061c 100644 --- a/internal/log/level.go +++ b/internal/log/level.go @@ -9,7 +9,7 @@ import ( "strconv" "strings" - "github.com/fatih/color" //nolint:misspell + "github.com/fatih/color" ) // Level is the level of the logger. diff --git a/internal/log/log.go b/internal/log/log.go index 1ba748f349..ef32634ca5 100644 --- a/internal/log/log.go +++ b/internal/log/log.go @@ -9,7 +9,7 @@ import ( "strings" "time" - "github.com/fatih/color" //nolint:misspell + "github.com/fatih/color" ) func (l *Logger) log(logLevel Level, s string, args ...interface{}) { diff --git a/lib/blocktree/node.go b/lib/blocktree/node.go index 5eb4556860..ccca544f08 100644 --- a/lib/blocktree/node.go +++ b/lib/blocktree/node.go @@ -112,7 +112,7 @@ func (n *node) getLeaves(leaves []*node) []*node { leaves = []*node{} } - if n.children == nil || len(n.children) == 0 { + if len(n.children) == 0 { leaves = append(leaves, n) } diff --git a/lib/runtime/constants.go b/lib/runtime/constants.go index 8b2bb40120..d1ba81f58a 100644 --- a/lib/runtime/constants.go +++ b/lib/runtime/constants.go @@ -87,7 +87,7 @@ const ( // ParachainHostValidationCodeByHash returns parachain host's validation code by hash ParachainHostValidationCodeByHash = "ParachainHost_validation_code_by_hash" // ParachainHostValidators is the runtime API call ParachainHost_validators - ParachainHostValidators = "ParachainHost_validators" //nolint + ParachainHostValidators = "ParachainHost_validators" // ParachainHostValidatorGroups is the runtime API call ParachainHost_validator_groups ParachainHostValidatorGroups = "ParachainHost_validator_groups" // ParachainHostAvailabilityCores is the runtime API call ParachainHost_availability_cores diff --git a/pkg/scale/decode_test.go b/pkg/scale/decode_test.go index 0a75f25f0d..828ae43576 100644 --- a/pkg/scale/decode_test.go +++ b/pkg/scale/decode_test.go @@ -307,7 +307,7 @@ func Test_unmarshal_optionality_nil_case(t *testing.T) { temp := reflect.New(reflect.TypeOf(t.in)) // create a new pointer to type of temp - tempv := reflect.New(reflect.PtrTo(temp.Type()).Elem()) + tempv := reflect.New(reflect.PointerTo(temp.Type()).Elem()) // set zero value to elem of **temp so that is nil tempv.Elem().Set(reflect.Zero(tempv.Elem().Type())) // set test.in to *temp diff --git a/pkg/scale/encode_test.go b/pkg/scale/encode_test.go index 8984725dcf..35993b2138 100644 --- a/pkg/scale/encode_test.go +++ b/pkg/scale/encode_test.go @@ -1222,7 +1222,7 @@ func Test_marshal_optionality_nil_cases(t *testing.T) { // create a new pointer to new zero value of t.in temp := reflect.New(reflect.TypeOf(t.in)) // create a new pointer to type of temp - tempv := reflect.New(reflect.PtrTo(temp.Type()).Elem()) + tempv := reflect.New(reflect.PointerTo(temp.Type()).Elem()) // set zero value to elem of **temp so that is nil tempv.Elem().Set(reflect.Zero(tempv.Elem().Type())) // set test.in to *temp diff --git a/pkg/trie/triedb/node.go b/pkg/trie/triedb/node.go index d3614afcb0..9b7168495b 100644 --- a/pkg/trie/triedb/node.go +++ b/pkg/trie/triedb/node.go @@ -156,7 +156,7 @@ func newNodeFromEncoded(nodeHash common.Hash, data []byte, storage NodeStorage) } return newChild, nil } - return nil, nil //nolint:nilnil + return nil, nil } children := [codec.ChildrenCapacity]NodeHandle{}