From 1ff5e2c049bdc9cdeaced7cc7edf135560960d31 Mon Sep 17 00:00:00 2001 From: Daniil Ankushin Date: Tue, 17 Sep 2024 11:31:16 +0300 Subject: [PATCH] chore: Update golangci-lint to version 1.61.0 (#2154) * chore: Update golangci-lint to version 1.61.0 * chore: Exclude G115 from gosec linter Exclude G115 from the gosec linter to address the issue with https://github.com/securego/gosec/issues/1212. * chore: Remove unused variable assignments Remove unused variable assignments in node/node.go and utils/pipeline/pipeline_test.go files. * chore: Remove unused nolint directives Remove unused nolint directives in the starknet client.go and handlers.go files. --- .golangci.yaml | 10 ++++++---- Makefile | 2 +- node/node.go | 1 - p2p/starknet/client.go | 2 -- p2p/starknet/handlers.go | 2 -- utils/pipeline/pipeline_test.go | 1 - 6 files changed, 7 insertions(+), 11 deletions(-) diff --git a/.golangci.yaml b/.golangci.yaml index 8838350c20..bfd9f863bb 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -67,6 +67,10 @@ linters-settings: exhaustruct: include: [] + gosec: + excludes: + - G115 #TODO: remove after fixing https://github.com/securego/gosec/issues/1212 + linters: disable-all: true enable: @@ -75,7 +79,7 @@ linters: - dogsled - dupl - errcheck - - exportloopref + - copyloopvar - funlen - gochecknoinits - goconst @@ -108,14 +112,12 @@ linters: # don't enable: # - asciicheck - # - scopelint # - gochecknoglobals # - gocognit # - godot # - godox - # - goerr113 + # - err113 # - interfacer - # - maligned # - nestif # - prealloc # - testpackage diff --git a/Makefile b/Makefile index 1bddce65e9..546dd7cb79 100644 --- a/Makefile +++ b/Makefile @@ -83,7 +83,7 @@ install-mockgen: go install go.uber.org/mock/mockgen@latest install-golangci-lint: - @which golangci-lint || go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.60.1 + @which golangci-lint || go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.61.0 lint: install-golangci-lint golangci-lint run diff --git a/node/node.go b/node/node.go index 1f211cd808..abd0b93990 100644 --- a/node/node.go +++ b/node/node.go @@ -352,7 +352,6 @@ func (n *Node) Run(ctx context.Context) { } for _, s := range n.services { - s := s wg.Go(func() { // Immediately acknowledge panicing services by shutting down the node // Without the deffered cancel(), we would have to wait for user to hit Ctrl+C diff --git a/p2p/starknet/client.go b/p2p/starknet/client.go index 1a80eaf62e..ada3fbd209 100644 --- a/p2p/starknet/client.go +++ b/p2p/starknet/client.go @@ -1,7 +1,5 @@ package starknet -// TODO: remove this nolint when the issue is fixed https://github.com/daixiang0/gci/issues/209 -//nolint:gci import ( "context" "errors" diff --git a/p2p/starknet/handlers.go b/p2p/starknet/handlers.go index bbddda3076..28c4eee5f3 100644 --- a/p2p/starknet/handlers.go +++ b/p2p/starknet/handlers.go @@ -1,8 +1,6 @@ //go:generate protoc --go_out=./ --proto_path=./ --go_opt=Mp2p/proto/transaction.proto=./spec --go_opt=Mp2p/proto/state.proto=./spec --go_opt=Mp2p/proto/snapshot.proto=./spec --go_opt=Mp2p/proto/receipt.proto=./spec --go_opt=Mp2p/proto/mempool.proto=./spec --go_opt=Mp2p/proto/event.proto=./spec --go_opt=Mp2p/proto/block.proto=./spec --go_opt=Mp2p/proto/common.proto=./spec p2p/proto/transaction.proto p2p/proto/state.proto p2p/proto/snapshot.proto p2p/proto/common.proto p2p/proto/block.proto p2p/proto/event.proto p2p/proto/receipt.proto package starknet -// TODO: remove this nolint when the issue is fixed https://github.com/daixiang0/gci/issues/209 -//nolint:gci import ( "bytes" "context" diff --git a/utils/pipeline/pipeline_test.go b/utils/pipeline/pipeline_test.go index 5b5156d109..91341240f7 100644 --- a/utils/pipeline/pipeline_test.go +++ b/utils/pipeline/pipeline_test.go @@ -52,7 +52,6 @@ func TestPipeline(t *testing.T) { var chs []<-chan string for n := range nums { - n := n strCh := make(chan string) go func() { defer close(strCh)