diff --git a/.golangci.yml b/.golangci.yml index d14fe1963a..59be9b021d 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -4,7 +4,7 @@ run: linters: enable: - - exportloopref + - copyloopvar - gofumpt - misspell - nakedret diff --git a/app/test/priority_test.go b/app/test/priority_test.go index 72586e5718..da7936dd0d 100644 --- a/app/test/priority_test.go +++ b/app/test/priority_test.go @@ -80,7 +80,6 @@ func (s *PriorityTestSuite) TestPriorityByGasPrice() { wg := &sync.WaitGroup{} for _, accName := range s.accountNames { wg.Add(1) - accName := accName // new variable per iteration go func() { defer wg.Done() // ensure that it is greater than the min gas price diff --git a/pkg/da/data_availability_header_test.go b/pkg/da/data_availability_header_test.go index fa73aeaa5e..7649750d09 100644 --- a/pkg/da/data_availability_header_test.go +++ b/pkg/da/data_availability_header_test.go @@ -88,7 +88,6 @@ func TestExtendShares(t *testing.T) { } for _, tt := range tests { - tt := tt _, err := ExtendShares(tt.shares) if tt.expectedErr { require.NotNil(t, err) @@ -122,7 +121,6 @@ func TestDataAvailabilityHeaderProtoConversion(t *testing.T) { } for _, tt := range tests { - tt := tt pdah, err := tt.dah.ToProto() require.NoError(t, err) resDah, err := DataAvailabilityHeaderFromProto(pdah) @@ -203,7 +201,6 @@ func Test_DAHValidateBasic(t *testing.T) { } for _, tt := range tests { - tt := tt err := tt.dah.ValidateBasic() if tt.expectErr { require.True(t, strings.Contains(err.Error(), tt.errStr), tt.name) diff --git a/x/blob/client/testutil/integration_test.go b/x/blob/client/testutil/integration_test.go index d29de7f658..b5f6c24db2 100644 --- a/x/blob/client/testutil/integration_test.go +++ b/x/blob/client/testutil/integration_test.go @@ -143,7 +143,6 @@ func (s *IntegrationTestSuite) TestSubmitPayForBlob() { } for _, tc := range testCases { - tc := tc require.NoError(s.ctx.WaitForNextBlock()) s.Run(tc.name, func() { cmd := paycli.CmdPayForBlob() diff --git a/x/blobstream/keeper/keeper_data_commitment.go b/x/blobstream/keeper/keeper_data_commitment.go index 0b0d656992..19bfc6d01c 100644 --- a/x/blobstream/keeper/keeper_data_commitment.go +++ b/x/blobstream/keeper/keeper_data_commitment.go @@ -109,7 +109,7 @@ func (k Keeper) GetLatestDataCommitment(ctx sdk.Context) (types.DataCommitment, return types.DataCommitment{}, err } if !found { - return types.DataCommitment{}, errors.Wrapf(types.ErrAttestationNotFound, fmt.Sprintf("nonce %d", i)) + return types.DataCommitment{}, errors.Wrapf(types.ErrAttestationNotFound, "nonce %d", i) } dcc, ok := att.(*types.DataCommitment) if !ok { @@ -136,7 +136,7 @@ func (k Keeper) HasDataCommitmentInStore(ctx sdk.Context) (bool, error) { return false, err } if !found { - return false, errors.Wrapf(types.ErrAttestationNotFound, fmt.Sprintf("nonce %d", i)) + return false, errors.Wrapf(types.ErrAttestationNotFound, "nonce %d", i) } _, ok := att.(*types.DataCommitment) if !ok { diff --git a/x/blobstream/keeper/keeper_valset_test.go b/x/blobstream/keeper/keeper_valset_test.go index d4b72406bf..6a73da03eb 100644 --- a/x/blobstream/keeper/keeper_valset_test.go +++ b/x/blobstream/keeper/keeper_valset_test.go @@ -57,7 +57,6 @@ func TestCurrentValsetNormalization(t *testing.T) { }, } for msg, spec := range specs { - spec := spec t.Run(msg, func(t *testing.T) { input, ctx := testutil.SetupTestChain(t, spec.srcPowers) r, err := input.BlobstreamKeeper.GetCurrentValset(ctx) diff --git a/x/mint/client/testutil/suite_test.go b/x/mint/client/testutil/suite_test.go index 9be2f45fc8..4910fcc99d 100644 --- a/x/mint/client/testutil/suite_test.go +++ b/x/mint/client/testutil/suite_test.go @@ -68,8 +68,6 @@ func (s *IntegrationTestSuite) TestGetCmdQueryInflationRate() { } for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { cmd := cli.GetCmdQueryInflationRate() @@ -103,8 +101,6 @@ func (s *IntegrationTestSuite) TestGetCmdQueryAnnualProvisions() { expectedAnnualProvision := mint.InitialInflationRateAsDec().MulInt(sdk.NewInt(testnode.DefaultInitialBalance)) for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { cmd := cli.GetCmdQueryAnnualProvisions() out, err := clitestutil.ExecTestCLICmd(s.cctx.Context, cmd, tc.args) @@ -134,8 +130,6 @@ func (s *IntegrationTestSuite) TestGetCmdQueryGenesisTime() { } for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { cmd := cli.GetCmdQueryGenesisTime() out, err := clitestutil.ExecTestCLICmd(s.cctx.Context, cmd, tc.args) diff --git a/x/mint/simulation/decoder_test.go b/x/mint/simulation/decoder_test.go index 74a634db87..c4122a316a 100644 --- a/x/mint/simulation/decoder_test.go +++ b/x/mint/simulation/decoder_test.go @@ -51,7 +51,6 @@ func TestDecodeStore(t *testing.T) { } for i, tt := range tests { - i, tt := i, tt t.Run(tt.name, func(t *testing.T) { if tt.expectPanic { require.Panics(t, func() { decoder(kvPairs.Pairs[i], kvPairs.Pairs[i]) }, tt.name)