From 5ffa175830207d6da20121b70ced41cac3fed3e0 Mon Sep 17 00:00:00 2001 From: Vlad <13818348+walldiss@users.noreply.github.com> Date: Fri, 23 Aug 2024 11:49:36 +0200 Subject: [PATCH] chore(lint): bump golang-ci lint to 1.60 (#3678) --- .github/workflows/go-ci.yml | 2 +- .golangci.yml | 6 ++++-- core/exchange.go | 1 - nodebuilder/rpc/flags_test.go | 4 ++-- share/eds/retriever_test.go | 1 - share/eds/utils.go | 2 -- share/getters/getter_test.go | 1 - share/ipld/get_shares_test.go | 2 -- 8 files changed, 7 insertions(+), 12 deletions(-) diff --git a/.github/workflows/go-ci.yml b/.github/workflows/go-ci.yml index df59d0cb73..e5e51d7005 100644 --- a/.github/workflows/go-ci.yml +++ b/.github/workflows/go-ci.yml @@ -44,7 +44,7 @@ jobs: uses: golangci/golangci-lint-action@v6.1.0 with: args: --timeout 10m - version: v1.59 + version: v1.60 skip-cache: true lint-imports: diff --git a/.golangci.yml b/.golangci.yml index 6e16c19007..d0b94ca9ae 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -13,7 +13,7 @@ linters: # - funlen # - gochecknoglobals # - gochecknoinits - - exportloopref + - copyloopvar - gocheckcompilerdirectives - goconst - gocritic @@ -40,7 +40,6 @@ linters: - prealloc - protogetter # - scopelint - deprecated since v1.39. exportloopref will be used instead - - exportloopref - staticcheck - stylecheck - typecheck @@ -68,6 +67,9 @@ issues: max-same-issues: 50 linters-settings: + gosec: + excludes: + - G115 # integer overflow conversion dogsled: max-blank-identifiers: 3 golint: diff --git a/core/exchange.go b/core/exchange.go index 61dd701bb4..6593111e5f 100644 --- a/core/exchange.go +++ b/core/exchange.go @@ -104,7 +104,6 @@ func (ce *Exchange) getRangeByHeight(ctx context.Context, from, amount uint64) ( errGroup, ctx := errgroup.WithContext(ctx) errGroup.SetLimit(concurrencyLimit) for i := range headers { - i := i errGroup.Go(func() error { extHeader, err := ce.GetByHeight(ctx, from+uint64(i)) if err != nil { diff --git a/nodebuilder/rpc/flags_test.go b/nodebuilder/rpc/flags_test.go index 1370995833..27a5ee857b 100644 --- a/nodebuilder/rpc/flags_test.go +++ b/nodebuilder/rpc/flags_test.go @@ -80,11 +80,11 @@ func TestParseFlags(t *testing.T) { err := cmd.Flags().Set(addrFlag, test.addrFlag) if err != nil { - t.Errorf(err.Error()) + t.Errorf("error setting addrFlag: %s", err) } err = cmd.Flags().Set(portFlag, test.portFlag) if err != nil { - t.Errorf(err.Error()) + t.Errorf("error setting portFlag: %s", err) } ParseFlags(cmd, cfg) diff --git a/share/eds/retriever_test.go b/share/eds/retriever_test.go index 3c0763f62a..5c098da55e 100644 --- a/share/eds/retriever_test.go +++ b/share/eds/retriever_test.go @@ -45,7 +45,6 @@ func TestRetriever_Retrieve(t *testing.T) { {"128x128(max)", share.MaxSquareSize}, } for _, tc := range tests { - tc := tc t.Run(tc.name, func(t *testing.T) { // generate EDS shares := sharetest.RandShares(t, tc.squareSize*tc.squareSize) diff --git a/share/eds/utils.go b/share/eds/utils.go index b897dd14b5..fd152e246f 100644 --- a/share/eds/utils.go +++ b/share/eds/utils.go @@ -129,8 +129,6 @@ func CollectSharesByNamespace( errGroup, ctx := errgroup.WithContext(ctx) shares = make([]share.NamespacedRow, len(rootCIDs)) for i, rootCID := range rootCIDs { - // shadow loop variables, to ensure correct values are captured - i, rootCID := i, rootCID errGroup.Go(func() error { row, proof, err := ipld.GetSharesByNamespace(ctx, bg, rootCID, namespace, len(root.RowRoots)) shares[i] = share.NamespacedRow{ diff --git a/share/getters/getter_test.go b/share/getters/getter_test.go index 16766299f2..47a3c4ac24 100644 --- a/share/getters/getter_test.go +++ b/share/getters/getter_test.go @@ -301,7 +301,6 @@ func BenchmarkIPLDGetterOverBusyCache(b *testing.B) { g := sync.WaitGroup{} g.Add(blocks) for _, h := range headers { - h := h go func() { defer g.Done() _, err := getter.GetEDS(ctx, h) diff --git a/share/ipld/get_shares_test.go b/share/ipld/get_shares_test.go index 93a697ffde..0e150dc811 100644 --- a/share/ipld/get_shares_test.go +++ b/share/ipld/get_shares_test.go @@ -70,8 +70,6 @@ func TestBlockRecovery(t *testing.T) { {"missing all but one shares", allShares, true, "failed to solve data square", extendedShareCount - 1}, } for _, tc := range testCases { - tc := tc - t.Run(tc.name, func(t *testing.T) { squareSize := utils.SquareSize(len(tc.shares))