diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 1585e7787..c50dd8b51 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -30,7 +30,7 @@ jobs: - uses: actions/checkout@v4 - name: golangci-lint-junod - uses: golangci/golangci-lint-action@v4 + uses: golangci/golangci-lint-action@v6 with: version: latest args: --timeout 10m diff --git a/.github/workflows/interchaintest-E2E.yml b/.github/workflows/interchaintest-E2E.yml index 417550215..0b68a8834 100644 --- a/.github/workflows/interchaintest-E2E.yml +++ b/.github/workflows/interchaintest-E2E.yml @@ -106,7 +106,7 @@ jobs: - name: Retry Failed Test if: steps.run_test.outcome == 'failure' run: | - for i in 1 2; do + for i in 1 2 3; do echo "Retry attempt $i" if make ${{ matrix.test }}; then echo "Test passed on retry" diff --git a/.golangci.yml b/.golangci.yml index 35ef949a4..e957651e1 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -7,6 +7,7 @@ linters: disable-all: true enable: - bodyclose + - copyloopvar - dogsled - errcheck - goconst @@ -18,6 +19,7 @@ linters: - gosimple - govet - ineffassign + - maintidx - misspell - nakedret - exportloopref diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index 9840b0bcb..35ec41c99 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -202,7 +202,7 @@ type AppKeepers struct { HooksICS4Wrapper ibc_hooks.ICS4Middleware } -func NewAppKeepers( +func NewAppKeepers( //nolint:maintidx // TODO: make this function less complex so it doesn't trigger the maintainability index appCodec codec.Codec, bApp *baseapp.BaseApp, cdc *codec.LegacyAmino, diff --git a/app/upgrades/v16/upgrades.go b/app/upgrades/v16/upgrades.go index fa659158c..dbb98ede3 100644 --- a/app/upgrades/v16/upgrades.go +++ b/app/upgrades/v16/upgrades.go @@ -53,7 +53,6 @@ func CreateV16UpgradeHandler( // https://github.com/cosmos/cosmos-sdk/pull/12363/files // Set param key table for params module migration for _, subspace := range keepers.ParamsKeeper.GetSubspaces() { - subspace := subspace var keyTable paramstypes.KeyTable switch subspace.Name() { diff --git a/app/upgrades/v17/upgrades.go b/app/upgrades/v17/upgrades.go index ff2e64f3d..1052b743f 100644 --- a/app/upgrades/v17/upgrades.go +++ b/app/upgrades/v17/upgrades.go @@ -96,7 +96,6 @@ func migrateChainOwnedSubDaos(ctx sdk.Context, logger log.Logger, ak authkeeper. distrAddr := ak.GetModuleAddress(distrtypes.ModuleName) for _, dao := range subDaos { - dao := dao logger.Info("migrating " + dao + " to the gov module") cAddr := sdk.MustAccAddressFromBech32(dao) diff --git a/app/upgrades/v23/upgrades.go b/app/upgrades/v23/upgrades.go index 344b9a5c6..9c252d7a1 100644 --- a/app/upgrades/v23/upgrades.go +++ b/app/upgrades/v23/upgrades.go @@ -50,7 +50,6 @@ func CreateV23UpgradeHandler( // migrate ICQ params for _, subspace := range keepers.ParamsKeeper.GetSubspaces() { - subspace := subspace var keyTable paramstypes.KeyTable if subspace.Name() == icqtypes.ModuleName { diff --git a/x/clock/keeper/msg_server_test.go b/x/clock/keeper/msg_server_test.go index f7eb85e0b..ac96b6e57 100644 --- a/x/clock/keeper/msg_server_test.go +++ b/x/clock/keeper/msg_server_test.go @@ -71,7 +71,6 @@ func (s *IntegrationTestSuite) TestRegisterClockContract() { success: false, }, } { - tc := tc s.Run(tc.desc, func() { // Set params params := types.DefaultParams() @@ -158,7 +157,6 @@ func (s *IntegrationTestSuite) TestUnregisterClockContract() { success: false, }, } { - tc := tc s.Run(tc.desc, func() { s.RegisterClockContract(addr.String(), contractAddress) s.RegisterClockContract(addr2.String(), contractAddressWithAdmin) @@ -284,7 +282,6 @@ func (s *IntegrationTestSuite) TestUnjailClockContract() { success: false, }, } { - tc := tc s.Run(tc.desc, func() { s.RegisterClockContract(addr.String(), contractAddress) s.JailClockContract(contractAddress) diff --git a/x/clock/keeper/querier_test.go b/x/clock/keeper/querier_test.go index fdb0d5ce2..44d03ae47 100644 --- a/x/clock/keeper/querier_test.go +++ b/x/clock/keeper/querier_test.go @@ -30,7 +30,6 @@ func (s *IntegrationTestSuite) TestQueryClockParams() { }, }, } { - tc := tc s.Run(tc.desc, func() { // Set params err := s.app.AppKeepers.ClockKeeper.SetParams(s.ctx, tc.params) @@ -78,7 +77,6 @@ func (s *IntegrationTestSuite) TestQueryClockContracts() { }, }, } { - tc := tc s.Run(tc.desc, func() { // Loop through contracts & register for _, contract := range tc.contracts { @@ -135,7 +133,6 @@ func (s *IntegrationTestSuite) TestQueryJailedClockContracts() { }, }, } { - tc := tc s.Run(tc.desc, func() { // Loop through contracts & register for _, contract := range tc.contracts { @@ -214,7 +211,6 @@ func (s *IntegrationTestSuite) TestQueryClockContract() { success: false, }, } { - tc := tc s.Run(tc.desc, func() { // Query contract resp, err := s.queryClient.ClockContract(s.ctx, &types.QueryClockContract{ diff --git a/x/cw-hooks/keeper/msg_server_test.go b/x/cw-hooks/keeper/msg_server_test.go index 337014a4b..0a23378bc 100644 --- a/x/cw-hooks/keeper/msg_server_test.go +++ b/x/cw-hooks/keeper/msg_server_test.go @@ -75,7 +75,6 @@ func (s *IntegrationTestSuite) TestRegisterContracts() { shouldErr: false, }, } { - tc := tc s.Run(tc.desc, func() { goCtx := sdk.WrapSDKContext(s.ctx) // staking @@ -166,7 +165,6 @@ func (s *IntegrationTestSuite) TestUnRegisterContracts() { shouldErr: true, }, } { - tc := tc s.Run(tc.desc, func() { goCtx := sdk.WrapSDKContext(s.ctx) // staking diff --git a/x/drip/keeper/grpc_query_test.go b/x/drip/keeper/grpc_query_test.go index 361e97bb6..36e941cef 100644 --- a/x/drip/keeper/grpc_query_test.go +++ b/x/drip/keeper/grpc_query_test.go @@ -44,7 +44,6 @@ func (s *IntegrationTestSuite) TestDripQueryParams() { }, }, } { - tc := tc s.Run(tc.desc, func() { // Set the params to what is expected, then query and ensure the query is the same err := s.app.AppKeepers.DripKeeper.SetParams(s.ctx, tc.Expected) diff --git a/x/drip/keeper/msg_server_test.go b/x/drip/keeper/msg_server_test.go index 8b09e04bb..696b7455d 100644 --- a/x/drip/keeper/msg_server_test.go +++ b/x/drip/keeper/msg_server_test.go @@ -71,7 +71,6 @@ func (s *IntegrationTestSuite) TestDripDistributeTokensMsgs() { success: false, }, } { - tc := tc s.Run(tc.desc, func() { msg := types.MsgDistributeTokens{ SenderAddress: tc.senderAddr, @@ -135,7 +134,6 @@ func (s *IntegrationTestSuite) TestUpdateDripParams() { success: false, }, } { - tc := tc s.Run(tc.desc, func() { params := types.Params{ EnableDrip: tc.isEnabled, diff --git a/x/feepay/keeper/msg_server_test.go b/x/feepay/keeper/msg_server_test.go index 40141e425..444b7846b 100644 --- a/x/feepay/keeper/msg_server_test.go +++ b/x/feepay/keeper/msg_server_test.go @@ -63,8 +63,6 @@ func (s *IntegrationTestSuite) TestRegisterFeePayContract() { shouldErr: true, }, } { - tc := tc - s.Run(tc.desc, func() { _, err := s.app.AppKeepers.FeePayKeeper.RegisterFeePayContract(s.ctx, &types.MsgRegisterFeePayContract{ SenderAddress: tc.senderAddress, @@ -138,8 +136,6 @@ func (s *IntegrationTestSuite) TestUnregisterFeePayContract() { shouldErr: true, }, } { - tc := tc - s.Run(tc.desc, func() { _, err := s.app.AppKeepers.FeePayKeeper.UnregisterFeePayContract(s.ctx, &types.MsgUnregisterFeePayContract{ SenderAddress: tc.senderAddress, @@ -208,8 +204,6 @@ func (s *IntegrationTestSuite) TestFundFeePayContract() { shouldErr: false, }, } { - tc := tc - s.Run(tc.desc, func() { _, err := s.app.AppKeepers.FeePayKeeper.FundFeePayContract(s.ctx, &types.MsgFundFeePayContract{ SenderAddress: tc.senderAddress, @@ -295,8 +289,6 @@ func (s *IntegrationTestSuite) TestUpdateFeePayContractWalletLimit() { shouldErr: false, }, } { - tc := tc - s.Run(tc.desc, func() { _, err := s.app.AppKeepers.FeePayKeeper.UpdateFeePayContractWalletLimit(s.ctx, &types.MsgUpdateFeePayContractWalletLimit{ SenderAddress: tc.senderAddress, diff --git a/x/feepay/keeper/querier_test.go b/x/feepay/keeper/querier_test.go index c921b2e3c..b0e0bbd35 100644 --- a/x/feepay/keeper/querier_test.go +++ b/x/feepay/keeper/querier_test.go @@ -49,7 +49,6 @@ func (s *IntegrationTestSuite) TestQueryContractBalance() { {balance: 0}, {balance: 1_000_000}, } { - bal := bal // Instantiate the contractAddr contractAddr := s.InstantiateContract(sender.String(), "") diff --git a/x/feeshare/keeper/msg_server_test.go b/x/feeshare/keeper/msg_server_test.go index 9f9c58ed5..62e600e05 100644 --- a/x/feeshare/keeper/msg_server_test.go +++ b/x/feeshare/keeper/msg_server_test.go @@ -97,7 +97,6 @@ func (s *IntegrationTestSuite) TestGetContractAdminOrCreatorAddress() { shouldErr: true, }, } { - tc := tc s.Run(tc.desc, func() { if !tc.shouldErr { _, err := s.app.AppKeepers.FeeShareKeeper.GetContractAdminOrCreatorAddress(s.ctx, sdk.MustAccAddressFromBech32(tc.contractAddress), tc.deployerAddress) @@ -222,7 +221,6 @@ func (s *IntegrationTestSuite) TestRegisterFeeShare() { shouldErr: false, }, } { - tc := tc s.Run(tc.desc, func() { goCtx := sdk.WrapSDKContext(s.ctx) if !tc.shouldErr { @@ -317,7 +315,6 @@ func (s *IntegrationTestSuite) TestUpdateFeeShare() { shouldErr: false, }, } { - tc := tc s.Run(tc.desc, func() { goCtx := sdk.WrapSDKContext(s.ctx) if !tc.shouldErr { @@ -383,7 +380,6 @@ func (s *IntegrationTestSuite) TestCancelFeeShare() { shouldErr: false, }, } { - tc := tc s.Run(tc.desc, func() { goCtx := sdk.WrapSDKContext(s.ctx) if !tc.shouldErr { diff --git a/x/mint/client/testutil/suite.go b/x/mint/client/testutil/suite.go index 5248e8b00..eea70f96a 100644 --- a/x/mint/client/testutil/suite.go +++ b/x/mint/client/testutil/suite.go @@ -79,8 +79,6 @@ mint_denom: stake`, } for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { cmd := cli.GetCmdQueryParams() clientCtx := val.ClientCtx @@ -113,8 +111,6 @@ func (s *IntegrationTestSuite) TestGetCmdQueryInflation() { } for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { cmd := cli.GetCmdQueryInflation() clientCtx := val.ClientCtx @@ -147,8 +143,6 @@ func (s *IntegrationTestSuite) TestGetCmdQueryAnnualProvisions() { } for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { cmd := cli.GetCmdQueryAnnualProvisions() clientCtx := val.ClientCtx diff --git a/x/mint/simulation/decoder_test.go b/x/mint/simulation/decoder_test.go index 24d75eea1..80c4b46fa 100644 --- a/x/mint/simulation/decoder_test.go +++ b/x/mint/simulation/decoder_test.go @@ -36,7 +36,6 @@ func TestDecodeStore(t *testing.T) { } for i, tt := range tests { - i, tt := i, tt t.Run(tt.name, func(t *testing.T) { switch i { case len(tests) - 1: diff --git a/x/mint/simulation/genesis_test.go b/x/mint/simulation/genesis_test.go index b33fa7b52..a99512017 100644 --- a/x/mint/simulation/genesis_test.go +++ b/x/mint/simulation/genesis_test.go @@ -77,7 +77,6 @@ func TestRandomizedGenState1(t *testing.T) { } for _, tt := range tests { - tt := tt require.Panicsf(t, func() { simulation.RandomizedGenState(&tt.simState) }, tt.panicMsg) } } diff --git a/x/tokenfactory/bindings/validate_queries_test.go b/x/tokenfactory/bindings/validate_queries_test.go index de358f70f..00400348a 100644 --- a/x/tokenfactory/bindings/validate_queries_test.go +++ b/x/tokenfactory/bindings/validate_queries_test.go @@ -101,8 +101,6 @@ func TestDenomAdmin(t *testing.T) { } for _, tc := range testCases { - tc := tc - t.Run(tc.name, func(t *testing.T) { resp, err := queryPlugin.GetDenomAdmin(ctx, tc.denom) if tc.expectErr {