From cbdfd9bdfa6a596f7f04e2dba5bae5275be131fb Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Mon, 16 Sep 2024 21:11:19 +0200 Subject: [PATCH] chore: bump golangci-lint and fix all linting issues (#21761) --- .golangci.yml | 12 +++++----- baseapp/abci_test.go | 3 +-- baseapp/abci_utils.go | 6 ++--- baseapp/internal/protocompat/protocompat.go | 2 +- baseapp/snapshot_test.go | 1 - client/cmd_test.go | 2 -- client/config/config_test.go | 1 - client/flags/flags_test.go | 2 -- client/keys/add_ledger_test.go | 1 - client/keys/add_test.go | 1 - client/keys/list_test.go | 1 - client/keys/parse_test.go | 1 - client/keys/show_test.go | 2 -- client/tx/aux_builder_test.go | 1 - client/tx/tx_test.go | 11 ++++----- client/utils_test.go | 1 - codec/amino_codec_test.go | 2 -- codec/codec_common_test.go | 2 +- codec/unknownproto/unit_helpers_test.go | 1 - codec/unknownproto/unknown_fields_test.go | 4 ---- crypto/hd/hdpath_test.go | 4 ---- crypto/keyring/keyring_test.go | 2 +- crypto/keyring/signing_algorithms_test.go | 1 - crypto/keys/secp256k1/secp256k1.go | 6 ++--- .../keys/secp256k1/secp256k1_internal_test.go | 1 - crypto/keys/secp256k1/secp256k1_test.go | 1 - crypto/types/compact_bit_array_test.go | 6 ----- errors/abci_test.go | 2 +- math/dec_internal_test.go | 1 - math/dec_test.go | 3 +-- math/int_test.go | 1 - math/uint_test.go | 2 +- orm/encoding/ormfield/duration_test.go | 2 -- orm/encoding/ormfield/timestamp_test.go | 1 - runtime/app.go | 4 ++-- runtime/module.go | 2 +- runtime/services.go | 2 +- runtime/services/autocli.go | 2 +- runtime/v2/manager.go | 1 - schema/appdata/mux.go | 2 +- schema/diff/diff_test.go | 2 ++ schema/field.go | 2 +- schema/testing/appdatasim/app_data_test.go | 2 +- scripts/build/linting.mk | 2 +- .../grpc/gogoreflection/fix_registration.go | 15 ++++++------ .../grpc/gogoreflection/serverreflection.go | 6 ++--- server/pruning_test.go | 2 -- server/start.go | 2 +- .../grpc/gogoreflection/fix_registration.go | 15 ++++++------ .../grpc/gogoreflection/serverreflection.go | 6 ++--- server/v2/api/telemetry/metrics.go | 2 +- server/v2/cometbft/abci_test.go | 10 +------- server/v2/server.go | 3 --- simapp/app.go | 4 ++-- simapp/genesis_account_test.go | 1 - simapp/v2/genesis_account_test.go | 1 - store/cachekv/search_test.go | 2 -- store/cachekv/store.go | 10 ++++---- store/cachekv/store_test.go | 8 +++++++ store/iavl/store.go | 6 ++--- store/iavl/store_test.go | 12 ++++------ store/internal/maps/maps.go | 24 +++++++++---------- store/listenkv/store_test.go | 2 +- store/pruning/manager_test.go | 2 +- store/rootmulti/snapshot_test.go | 2 -- store/rootmulti/store_test.go | 2 -- store/tracekv/store_test.go | 2 +- store/types/gas_test.go | 1 - store/types/iterator_test.go | 1 - store/types/store_test.go | 1 - store/v2/root/store_test.go | 1 - tests/e2e/auth/suite.go | 5 ---- tests/e2e/authz/grpc.go | 2 -- tests/e2e/authz/tx.go | 6 ----- .../client/grpc/cmtservice/service_test.go | 6 ----- tests/e2e/distribution/grpc_query_suite.go | 16 ++++++------- tests/e2e/gov/tx.go | 5 ---- tests/e2e/tx/service_test.go | 6 ----- .../integration/auth/client/cli/suite_test.go | 5 ---- .../auth/keeper/msg_server_test.go | 1 - tests/integration/distribution/cli_tx_test.go | 2 -- .../distribution/keeper/msg_server_test.go | 8 ------- tests/integration/genutil/genaccount_test.go | 2 -- tests/integration/genutil/init_test.go | 1 - .../staking/keeper/msg_server_test.go | 2 -- testutil/sims/simulation_helpers_test.go | 1 - tools/confix/migrations.go | 1 - tools/cosmovisor/args_test.go | 2 -- tools/cosmovisor/cmd/cosmovisor/init_test.go | 2 -- types/address_test.go | 2 -- types/coin.go | 2 -- types/coin_test.go | 13 ++-------- types/context_test.go | 1 - types/dec_coin_test.go | 14 ----------- types/events_test.go | 1 - types/module/module.go | 2 -- types/query/collections_pagination_test.go | 1 - types/simulation/account_test.go | 3 --- types/simulation/rand_util_test.go | 1 - types/tx/direct_aux_test.go | 2 -- types/utils_test.go | 4 +--- x/accounts/cli/cli_test.go | 1 - x/accounts/defaults/lockup/lockup_test.go | 1 - x/accounts/keeper.go | 2 +- x/auth/ante/basic_test.go | 2 -- x/auth/client/tx_test.go | 1 - x/auth/keeper/msg_server_test.go | 2 -- x/auth/migrations/legacytx/stdtx_test.go | 1 - x/auth/tx/aux_test.go | 1 - x/auth/tx/query.go | 2 -- x/auth/types/account_test.go | 3 --- x/auth/types/params_test.go | 1 - x/auth/types/permissions_test.go | 1 - x/auth/vesting/types/vesting_account_test.go | 2 -- x/authz/authorization_grant_test.go | 2 -- x/authz/keeper/grpc_query_test.go | 3 --- x/authz/simulation/decoder_test.go | 1 - x/bank/client/cli/tx_test.go | 1 - x/bank/keeper/genesis_test.go | 1 - x/bank/keeper/grpc_query_test.go | 2 -- x/bank/keeper/msg_server_test.go | 4 ---- x/bank/simulation/genesis_test.go | 2 -- x/bank/types/balance_test.go | 2 -- x/bank/types/genesis_test.go | 1 - x/bank/types/metadata_test.go | 2 -- x/distribution/client/common/common_test.go | 1 - x/distribution/keeper/grpc_query_test.go | 3 --- x/distribution/keeper/msg_server_test.go | 7 ------ x/distribution/simulation/decoder_test.go | 1 - x/distribution/simulation/genesis_test.go | 2 -- x/distribution/types/params_internal_test.go | 1 - x/evidence/keeper/msg_server_test.go | 1 - x/evidence/types/evidence_test.go | 1 - x/feegrant/client/cli/tx_test.go | 6 ----- x/feegrant/grant_test.go | 1 - x/feegrant/keeper/genesis_test.go | 1 - x/feegrant/simulation/decoder_test.go | 1 - x/genutil/client/cli/gentx_test.go | 1 - x/genutil/client/cli/migrate_test.go | 1 - x/genutil/client/cli/validate_genesis_test.go | 2 -- x/genutil/utils_test.go | 1 - x/gov/client/cli/prompt_test.go | 1 - x/gov/client/cli/tx_test.go | 5 ---- x/gov/client/utils/query_test.go | 4 ---- x/gov/keeper/grpc_query_test.go | 3 --- x/gov/keeper/msg_server_test.go | 3 --- x/gov/migrations/v3/convert_test.go | 3 --- x/gov/simulation/genesis_test.go | 2 -- x/gov/types/v1/genesis_test.go | 1 - x/group/client/cli/tx_test.go | 12 ---------- x/group/genesis_test.go | 1 - x/group/internal/orm/auto_uint64_test.go | 1 - x/group/internal/orm/index_test.go | 1 - x/group/internal/orm/iterator.go | 2 +- x/group/internal/orm/iterator_test.go | 1 - x/group/internal/orm/orm_scenario_test.go | 1 - x/group/internal/orm/primary_key_test.go | 1 - x/group/keeper/abci_test.go | 2 -- x/group/keeper/grpc_query_test.go | 7 ------ x/group/keeper/keeper.go | 2 -- x/group/keeper/keeper_test.go | 1 - x/group/keeper/msg_server_test.go | 20 ++++------------ x/group/keeper/tally_test.go | 1 - x/group/simulation/decoder_test.go | 1 - x/mint/keeper/msg_server_test.go | 1 - x/nft/simulation/decoder_test.go | 1 - x/params/keeper/keeper_test.go | 7 ------ x/params/types/subspace_test.go | 1 - x/simulation/operation.go | 1 - x/slashing/keeper/msg_server_test.go | 2 -- x/slashing/simulation/decoder_test.go | 1 - x/staking/client/cli/tx_test.go | 4 ---- x/staking/genesis_test.go | 2 -- x/staking/keeper/grpc_query.go | 2 +- x/staking/keeper/msg_server_test.go | 7 ------ x/staking/simulation/decoder_test.go | 1 - x/staking/simulation/genesis_test.go | 2 -- x/staking/types/authz_test.go | 1 - x/tx/decode/unknown_test.go | 4 ---- x/tx/signing/textual/any_test.go | 1 - x/tx/signing/textual/dec_test.go | 1 - x/tx/signing/textual/handler_test.go | 1 - x/upgrade/keeper/grpc_query_test.go | 2 -- x/upgrade/keeper/keeper_test.go | 2 -- x/upgrade/types/plan_test.go | 3 --- x/upgrade/types/storeloader_test.go | 1 - 186 files changed, 114 insertions(+), 455 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index a976100278e9..9fa8a3398ac3 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -13,7 +13,7 @@ linters: - dogsled - errcheck - errorlint - - exportloopref + - copyloopvar - gci - goconst - gocritic @@ -45,15 +45,15 @@ issues: - crypto/keys/secp256k1/internal/* - types/coin_regex.go exclude-rules: - - text: "ST1003:" + - text: "ST1003:" # We are fine with our current naming linters: - stylecheck # FIXME: Disabled until golangci-lint updates stylecheck with this fix: # https://github.com/dominikh/go-tools/issues/389 - - text: "ST1016:" + - text: "ST1016:" # Ok with inconsistent receiver names linters: - stylecheck - - path: "migrations" + - path: "migrations" # migraitions always use deprecated code text: "SA1019:" linters: - staticcheck @@ -72,9 +72,9 @@ issues: - text: "SA1019: params.SendEnabled is deprecated" # TODO remove once ready to remove from the sdk linters: - staticcheck - - text: "SA1029: Inappropriate key in context.WithValue" # TODO remove this when dependency is updated + - text: "G115: integer overflow conversion" # We are doing this everywhere. linters: - - staticcheck + - gosec - text: "leading space" linters: - nolintlint diff --git a/baseapp/abci_test.go b/baseapp/abci_test.go index 07e7ea8199c9..fb61080916df 100644 --- a/baseapp/abci_test.go +++ b/baseapp/abci_test.go @@ -1589,7 +1589,6 @@ func TestABCI_GetBlockRetentionHeight(t *testing.T) { } for name, tc := range testCases { - tc := tc tc.bapp.SetParamStore(¶mStore{db: coretesting.NewMemDB()}) _, err := tc.bapp.InitChain(&abci.InitChainRequest{ @@ -2081,7 +2080,7 @@ func TestABCI_PrepareProposal_VoteExtensions(t *testing.T) { return nil, err } - cp := ctx.ConsensusParams() // nolint:staticcheck // ignore linting error + cp := ctx.ConsensusParams() //nolint:staticcheck // ignore linting error extsEnabled := cp.Feature.VoteExtensionsEnableHeight != nil && req.Height >= cp.Feature.VoteExtensionsEnableHeight.Value && cp.Feature.VoteExtensionsEnableHeight.Value != 0 if !extsEnabled { // check abci params diff --git a/baseapp/abci_utils.go b/baseapp/abci_utils.go index 63c13fa8620b..e7bb5904a7f7 100644 --- a/baseapp/abci_utils.go +++ b/baseapp/abci_utils.go @@ -47,7 +47,7 @@ func ValidateVoteExtensions( extCommit abci.ExtendedCommitInfo, ) error { // Get values from context - cp := ctx.ConsensusParams() // nolint:staticcheck // ignore linting error + cp := ctx.ConsensusParams() //nolint:staticcheck // ignore linting error currentHeight := ctx.HeaderInfo().Height chainID := ctx.HeaderInfo().ChainID commitInfo := ctx.CometInfo().LastCommit @@ -258,7 +258,7 @@ func (h *DefaultProposalHandler) SetTxSelector(ts TxSelector) { func (h *DefaultProposalHandler) PrepareProposalHandler() sdk.PrepareProposalHandler { return func(ctx sdk.Context, req *abci.PrepareProposalRequest) (*abci.PrepareProposalResponse, error) { var maxBlockGas uint64 - if b := ctx.ConsensusParams().Block; b != nil { // nolint:staticcheck // ignore linting error + if b := ctx.ConsensusParams().Block; b != nil { //nolint:staticcheck // ignore linting error maxBlockGas = uint64(b.MaxGas) } @@ -405,7 +405,7 @@ func (h *DefaultProposalHandler) ProcessProposalHandler() sdk.ProcessProposalHan var totalTxGas uint64 var maxBlockGas int64 - if b := ctx.ConsensusParams().Block; b != nil { // nolint:staticcheck // ignore linting error + if b := ctx.ConsensusParams().Block; b != nil { //nolint:staticcheck // ignore linting error maxBlockGas = b.MaxGas } diff --git a/baseapp/internal/protocompat/protocompat.go b/baseapp/internal/protocompat/protocompat.go index bd277e4a44f7..004efe635e2a 100644 --- a/baseapp/internal/protocompat/protocompat.go +++ b/baseapp/internal/protocompat/protocompat.go @@ -6,7 +6,7 @@ import ( "reflect" gogoproto "github.com/cosmos/gogoproto/proto" - "github.com/golang/protobuf/proto" // nolint: staticcheck // needed because gogoproto.Merge does not work consistently. See NOTE: comments. + "github.com/golang/protobuf/proto" //nolint: staticcheck // needed because gogoproto.Merge does not work consistently. See NOTE: comments. "google.golang.org/grpc" proto2 "google.golang.org/protobuf/proto" "google.golang.org/protobuf/reflect/protoreflect" diff --git a/baseapp/snapshot_test.go b/baseapp/snapshot_test.go index e6e6f1e5bd7d..e19b9cdfa9f5 100644 --- a/baseapp/snapshot_test.go +++ b/baseapp/snapshot_test.go @@ -245,7 +245,6 @@ func TestABCI_OfferSnapshot_Errors(t *testing.T) { }, abci.OFFER_SNAPSHOT_RESULT_REJECT}, } for name, tc := range testCases { - tc := tc t.Run(name, func(t *testing.T) { resp, err := suite.baseApp.OfferSnapshot(&abci.OfferSnapshotRequest{Snapshot: tc.snapshot}) require.NoError(t, err) diff --git a/client/cmd_test.go b/client/cmd_test.go index 559d31d39f40..31c7bf390b01 100644 --- a/client/cmd_test.go +++ b/client/cmd_test.go @@ -125,8 +125,6 @@ func TestSetCmdClientContextHandler(t *testing.T) { } for _, tc := range testCases { - tc := tc - t.Run(tc.name, func(t *testing.T) { cmd := newCmd() _ = testutil.ApplyMockIODiscardOutErr(cmd) diff --git a/client/config/config_test.go b/client/config/config_test.go index 248ed47cea9c..81fe9e9f56a1 100644 --- a/client/config/config_test.go +++ b/client/config/config_test.go @@ -145,7 +145,6 @@ func TestConfigCmdEnvFlag(t *testing.T) { } for _, tc := range tt { - tc := tc t.Run(tc.name, func(t *testing.T) { testCmd := &cobra.Command{ Use: "test", diff --git a/client/flags/flags_test.go b/client/flags/flags_test.go index 5cc591bebbe7..657de9c0e658 100644 --- a/client/flags/flags_test.go +++ b/client/flags/flags_test.go @@ -22,8 +22,6 @@ func TestParseGasSetting(t *testing.T) { } for _, tc := range testCases { - tc := tc - t.Run(tc.name, func(t *testing.T) { gs, err := flags.ParseGasSetting(tc.input) diff --git a/client/keys/add_ledger_test.go b/client/keys/add_ledger_test.go index 3d04cc5e3b92..d130127614f9 100644 --- a/client/keys/add_ledger_test.go +++ b/client/keys/add_ledger_test.go @@ -172,7 +172,6 @@ func Test_runAddCmdLedgerDryRun(t *testing.T) { } for _, tt := range testData { - tt := tt t.Run(tt.name, func(t *testing.T) { cmd := AddKeyCommand() cmd.Flags().AddFlagSet(Commands().PersistentFlags()) diff --git a/client/keys/add_test.go b/client/keys/add_test.go index 687aff609235..703bc5894c18 100644 --- a/client/keys/add_test.go +++ b/client/keys/add_test.go @@ -297,7 +297,6 @@ func Test_runAddCmdDryRun(t *testing.T) { }, } for _, tt := range testData { - tt := tt t.Run(tt.name, func(t *testing.T) { cmd := AddKeyCommand() cmd.Flags().AddFlagSet(Commands().PersistentFlags()) diff --git a/client/keys/list_test.go b/client/keys/list_test.go index 8f2752e5af9f..8660c0fe17d0 100644 --- a/client/keys/list_test.go +++ b/client/keys/list_test.go @@ -67,7 +67,6 @@ func Test_runListCmd(t *testing.T) { {"keybase: w/key", kbHome2, false}, } for _, tt := range testData { - tt := tt t.Run(tt.name, func(t *testing.T) { cmd.SetArgs([]string{ fmt.Sprintf("--%s=%s", flags.FlagKeyringDir, tt.kbDir), diff --git a/client/keys/parse_test.go b/client/keys/parse_test.go index 650cb7c501f0..88c9c31ec5e6 100644 --- a/client/keys/parse_test.go +++ b/client/keys/parse_test.go @@ -21,7 +21,6 @@ func TestParseKey(t *testing.T) { {"hex", []string{hexstr}, false}, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { require.Equal(t, tt.wantErr, doParseKey(ParseKeyStringCommand(), "cosmos", tt.args) != nil) }) diff --git a/client/keys/show_test.go b/client/keys/show_test.go index 2f75430638a6..f309ad73b195 100644 --- a/client/keys/show_test.go +++ b/client/keys/show_test.go @@ -237,7 +237,6 @@ func Test_validateMultisigThreshold(t *testing.T) { {"1-2", args{2, 1}, true}, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { if err := validateMultisigThreshold(tt.args.k, tt.args.nKeys); (err != nil) != tt.wantErr { t.Errorf("validateMultisigThreshold() error = %v, wantErr %v", err, tt.wantErr) @@ -272,7 +271,6 @@ func Test_getBechKeyOut(t *testing.T) { {"cons", args{sdk.PrefixConsensus}, MkConsKeyOutput, false}, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { output, err := getKeyOutput(ctx, tt.args.bechPrefix, k) if tt.wantErr { diff --git a/client/tx/aux_builder_test.go b/client/tx/aux_builder_test.go index f2083846ce38..6380f2d6ee50 100644 --- a/client/tx/aux_builder_test.go +++ b/client/tx/aux_builder_test.go @@ -214,7 +214,6 @@ func TestAuxTxBuilder(t *testing.T) { } for _, tc := range testcases { - tc := tc t.Run(tc.name, func(t *testing.T) { b = tx.NewAuxTxBuilder() err := tc.malleate() diff --git a/client/tx/tx_test.go b/client/tx/tx_test.go index 2669fe804983..21bfff6070b8 100644 --- a/client/tx/tx_test.go +++ b/client/tx/tx_test.go @@ -81,7 +81,6 @@ func TestCalculateGas(t *testing.T) { } for _, tc := range testCases { - stc := tc txCfg, _ := newTestTxConfig() defaultSignMode, err := signing.APISignModeToInternal(txCfg.SignModeHandler().DefaultMode()) require.NoError(t, err) @@ -90,16 +89,16 @@ func TestCalculateGas(t *testing.T) { WithChainID("test-chain"). WithTxConfig(txCfg).WithSignMode(defaultSignMode) - t.Run(stc.name, func(t *testing.T) { + t.Run(tc.name, func(t *testing.T) { mockClientCtx := mockContext{ gasUsed: tc.args.mockGasUsed, wantErr: tc.args.mockWantErr, } - simRes, gotAdjusted, err := CalculateGas(mockClientCtx, txf.WithGasAdjustment(stc.args.adjustment)) - if stc.expPass { + simRes, gotAdjusted, err := CalculateGas(mockClientCtx, txf.WithGasAdjustment(tc.args.adjustment)) + if tc.expPass { require.NoError(t, err) - require.Equal(t, simRes.GasInfo.GasUsed, stc.wantEstimate) - require.Equal(t, gotAdjusted, stc.wantAdjusted) + require.Equal(t, simRes.GasInfo.GasUsed, tc.wantEstimate) + require.Equal(t, gotAdjusted, tc.wantAdjusted) require.NotNil(t, simRes.Result) } else { require.Error(t, err) diff --git a/client/utils_test.go b/client/utils_test.go index c8cb93a9f56d..61bfb429cc3b 100644 --- a/client/utils_test.go +++ b/client/utils_test.go @@ -67,7 +67,6 @@ func TestPaginate(t *testing.T) { } for i, tc := range testCases { - i, tc := i, tc t.Run(tc.name, func(t *testing.T) { start, end := client.Paginate(tc.numObjs, tc.page, tc.limit, tc.defLimit) require.Equal(t, tc.expectedStart, start, "invalid result; test case #%d", i) diff --git a/codec/amino_codec_test.go b/codec/amino_codec_test.go index 63df85e83782..f15da6a1456b 100644 --- a/codec/amino_codec_test.go +++ b/codec/amino_codec_test.go @@ -71,8 +71,6 @@ func TestAminoCodecMarshalJSONIndent(t *testing.T) { } for _, tc := range testCases { - tc := tc - t.Run(tc.name, func(t *testing.T) { cdc := codec.NewAminoCodec(createTestCodec()) bz, err := cdc.MarshalJSONIndent(tc.input, "", " ") diff --git a/codec/codec_common_test.go b/codec/codec_common_test.go index 3280d2c195e3..4c0118f41994 100644 --- a/codec/codec_common_test.go +++ b/codec/codec_common_test.go @@ -122,7 +122,7 @@ func testMarshaling(t *testing.T, cdc interface { } for _, tc := range testCases { - tc := tc + m1 := mustMarshaler{cdc.Marshal, cdc.MustMarshal, cdc.Unmarshal, cdc.MustUnmarshal} m2 := mustMarshaler{cdc.MarshalLengthPrefixed, cdc.MustMarshalLengthPrefixed, cdc.UnmarshalLengthPrefixed, cdc.MustUnmarshalLengthPrefixed} m3 := mustMarshaler{ diff --git a/codec/unknownproto/unit_helpers_test.go b/codec/unknownproto/unit_helpers_test.go index 9c408a6d1f8a..b1564224892e 100644 --- a/codec/unknownproto/unit_helpers_test.go +++ b/codec/unknownproto/unit_helpers_test.go @@ -22,7 +22,6 @@ func TestWireTypeToString(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(fmt.Sprintf("wireType=%d", tt.typ), func(t *testing.T) { if g, w := wireTypeToString(tt.typ), tt.want; g != w { t.Fatalf("Mismatch:\nGot: %q\nWant: %q\n", g, w) diff --git a/codec/unknownproto/unknown_fields_test.go b/codec/unknownproto/unknown_fields_test.go index 7f2228e58436..85338f0595cb 100644 --- a/codec/unknownproto/unknown_fields_test.go +++ b/codec/unknownproto/unknown_fields_test.go @@ -223,7 +223,6 @@ func TestRejectUnknownFieldsRepeated(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { protoBlob, err := proto.Marshal(tt.in) if err != nil { @@ -280,7 +279,6 @@ func TestRejectUnknownFields_allowUnknownNonCriticals(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { blob, err := proto.Marshal(tt.in) if err != nil { @@ -483,7 +481,6 @@ func TestRejectUnknownFieldsNested(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { protoBlob, err := proto.Marshal(tt.in) if err != nil { @@ -634,7 +631,6 @@ func TestRejectUnknownFieldsFlat(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { blob, err := proto.Marshal(tt.in) if err != nil { diff --git a/crypto/hd/hdpath_test.go b/crypto/hd/hdpath_test.go index cce81df86f20..fa203911a58c 100644 --- a/crypto/hd/hdpath_test.go +++ b/crypto/hd/hdpath_test.go @@ -107,9 +107,7 @@ func TestCreateHDPath(t *testing.T) { {"m/44'/114'/1'/1/0", args{114, 1, 1}, hd.BIP44Params{Purpose: 44, CoinType: 114, Account: 1, AddressIndex: 1}}, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { - tt := tt require.Equal(t, tt.want, *hd.CreateHDPath(tt.args.coinType, tt.args.account, tt.args.index)) }) } @@ -170,7 +168,6 @@ func TestDeriveHDPathRange(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.path, func(t *testing.T) { master, ch := hd.ComputeMastersFromSeed(seed) _, err := hd.DerivePrivateKeyForPath(master, ch, tt.path) @@ -297,7 +294,6 @@ func TestDerivePrivateKeyForPathDoNotCrash(t *testing.T) { } for _, path := range paths { - path := path t.Run(path, func(t *testing.T) { _, _ = hd.DerivePrivateKeyForPath([32]byte{}, [32]byte{}, path) }) diff --git a/crypto/keyring/keyring_test.go b/crypto/keyring/keyring_test.go index 519cd01142f8..850cbcbafe04 100644 --- a/crypto/keyring/keyring_test.go +++ b/crypto/keyring/keyring_test.go @@ -2003,7 +2003,7 @@ func TestRenameKey(t *testing.T) { } for _, tc := range testCases { - tc := tc + kr := newKeyring(t, "testKeyring") t.Run(tc.name, func(t *testing.T) { tc.run(kr) diff --git a/crypto/keyring/signing_algorithms_test.go b/crypto/keyring/signing_algorithms_test.go index 624e491d098a..1ac7d9cc352e 100644 --- a/crypto/keyring/signing_algorithms_test.go +++ b/crypto/keyring/signing_algorithms_test.go @@ -36,7 +36,6 @@ func TestNewSigningAlgoByString(t *testing.T) { list := SigningAlgoList{hd.Secp256k1} for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { algorithm, err := NewSigningAlgoFromString(tt.algoStr, list) if tt.isSupported { diff --git a/crypto/keys/secp256k1/secp256k1.go b/crypto/keys/secp256k1/secp256k1.go index 4073684076ff..927b0eafe9e1 100644 --- a/crypto/keys/secp256k1/secp256k1.go +++ b/crypto/keys/secp256k1/secp256k1.go @@ -12,7 +12,7 @@ import ( "github.com/cometbft/cometbft/crypto" secp256k1dcrd "github.com/decred/dcrd/dcrec/secp256k1/v4" "gitlab.com/yawning/secp256k1-voi/secec" - "golang.org/x/crypto/ripemd160" //nolint: staticcheck // keep around for backwards compatibility + "golang.org/x/crypto/ripemd160" //nolint:staticcheck,gosec // keep around for backwards compatibility errorsmod "cosmossdk.io/errors" @@ -173,8 +173,8 @@ func (pubKey *PubKey) Address() crypto.Address { } sha := sha256.Sum256(pubKey.Key) - hasherRIPEMD160 := ripemd160.New() - hasherRIPEMD160.Write(sha[:]) // does not error + hasherRIPEMD160 := ripemd160.New() //nolint:gosec // keep around for backwards compatibility + hasherRIPEMD160.Write(sha[:]) // does not error return crypto.Address(hasherRIPEMD160.Sum(nil)) } diff --git a/crypto/keys/secp256k1/secp256k1_internal_test.go b/crypto/keys/secp256k1/secp256k1_internal_test.go index 08afa6014e4b..c0df3ed5286b 100644 --- a/crypto/keys/secp256k1/secp256k1_internal_test.go +++ b/crypto/keys/secp256k1/secp256k1_internal_test.go @@ -27,7 +27,6 @@ func Test_genPrivKey(t *testing.T) { {"valid because 0 < 1 < N", validOne, false}, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { if tt.shouldPanic { require.Panics(t, func() { diff --git a/crypto/keys/secp256k1/secp256k1_test.go b/crypto/keys/secp256k1/secp256k1_test.go index 76db9ec72306..bafab8b9f3af 100644 --- a/crypto/keys/secp256k1/secp256k1_test.go +++ b/crypto/keys/secp256k1/secp256k1_test.go @@ -255,7 +255,6 @@ func TestGenPrivKeyFromSecret(t *testing.T) { {"another seed used in cosmos tests #3", []byte("")}, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { gotPrivKey := secp256k1.GenPrivKeyFromSecret(tt.secret) require.NotNil(t, gotPrivKey) diff --git a/crypto/types/compact_bit_array_test.go b/crypto/types/compact_bit_array_test.go index 4831e8e681ea..1f7f276cff22 100644 --- a/crypto/types/compact_bit_array_test.go +++ b/crypto/types/compact_bit_array_test.go @@ -58,7 +58,6 @@ func TestBitArrayEqual(t *testing.T) { {name: "different should not be equal", b1: big1, b2: big2, eq: false}, } for _, tc := range cases { - tc := tc t.Run(tc.name, func(t *testing.T) { eq := tc.b1.Equal(tc.b2) require.Equal(t, tc.eq, eq) @@ -102,7 +101,6 @@ func TestJSONMarshalUnmarshal(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.bA.String(), func(t *testing.T) { bz, err := json.Marshal(tc.bA) require.NoError(t, err) @@ -162,7 +160,6 @@ func TestCompactMarshalUnmarshal(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.bA.String(), func(t *testing.T) { bz := tc.bA.CompactMarshal() @@ -209,8 +206,6 @@ func TestCompactBitArrayNumOfTrueBitsBefore(t *testing.T) { {`"______________xx"`, []int{14, 15}, []int{0, 1}}, } for tcIndex, tc := range testCases { - tc := tc - tcIndex := tcIndex t.Run(tc.marshalledBA, func(t *testing.T) { var bA *CompactBitArray err := json.Unmarshal([]byte(tc.marshalledBA), &bA) @@ -283,7 +278,6 @@ func TestNewCompactBitArrayCrashWithLimits(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(fmt.Sprintf("%d", tt.in), func(t *testing.T) { got := NewCompactBitArray(tt.in) if g := got != nil; g != tt.mustPass { diff --git a/errors/abci_test.go b/errors/abci_test.go index ca283997ae91..54afb8872600 100644 --- a/errors/abci_test.go +++ b/errors/abci_test.go @@ -102,7 +102,7 @@ func TestABCIInfoSerializeErr(t *testing.T) { }, } for msg, spec := range specs { - spec := spec + _, _, log := ABCIInfo(spec.src, spec.debug) if log != spec.exp { t.Errorf("%s: expected log %s, got %s", msg, spec.exp, log) diff --git a/math/dec_internal_test.go b/math/dec_internal_test.go index 8b899300e3b0..5273edfc9b5e 100644 --- a/math/dec_internal_test.go +++ b/math/dec_internal_test.go @@ -90,7 +90,6 @@ func (s *decimalInternalTestSuite) TestDecMarshalJSON() { {"12340Int", LegacyNewDec(12340), "\"12340.000000000000000000\"", false}, } for _, tt := range tests { - tt := tt s.T().Run(tt.name, func(t *testing.T) { got, err := tt.d.MarshalJSON() if (err != nil) != tt.wantErr { diff --git a/math/dec_test.go b/math/dec_test.go index 1e72e173e84f..775ddd3c23cd 100644 --- a/math/dec_test.go +++ b/math/dec_test.go @@ -261,7 +261,7 @@ func (s *decimalTestSuite) TestArithmetic() { } for tcIndex, tc := range tests { - tc := tc + resAdd := tc.d1.Add(tc.d2) resSub := tc.d1.Sub(tc.d2) resMul := tc.d1.Mul(tc.d2) @@ -727,7 +727,6 @@ func TestFormatDec(t *testing.T) { require.NoError(t, err) for _, tc := range testcases { - tc := tc t.Run(tc[0], func(t *testing.T) { out, err := math.FormatDec(tc[0]) require.NoError(t, err) diff --git a/math/int_test.go b/math/int_test.go index 714ef5e65e50..36c2e453ea06 100644 --- a/math/int_test.go +++ b/math/int_test.go @@ -591,7 +591,6 @@ func TestFormatIntCorrectness(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.in, func(t *testing.T) { got, err := math.FormatInt(tt.in) if err != nil { diff --git a/math/uint_test.go b/math/uint_test.go index 93abdf886dae..b02b442159b3 100644 --- a/math/uint_test.go +++ b/math/uint_test.go @@ -244,7 +244,7 @@ func (s *uintTestSuite) TestSafeSub() { } for i, tc := range testCases { - tc := tc + if tc.panic { s.Require().Panics(func() { tc.x.Sub(tc.y) }) continue diff --git a/orm/encoding/ormfield/duration_test.go b/orm/encoding/ormfield/duration_test.go index 485605ee0c1b..6f612ef1a1aa 100644 --- a/orm/encoding/ormfield/duration_test.go +++ b/orm/encoding/ormfield/duration_test.go @@ -140,7 +140,6 @@ func TestDurationOutOfRange(t *testing.T) { }, } for _, tc := range tt { - tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() val := protoreflect.ValueOfMessage(tc.dur.ProtoReflect()) @@ -272,7 +271,6 @@ func TestDurationCompare(t *testing.T) { } for _, tc := range tt { - tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() diff --git a/orm/encoding/ormfield/timestamp_test.go b/orm/encoding/ormfield/timestamp_test.go index 52b7caeadacd..401e940b2762 100644 --- a/orm/encoding/ormfield/timestamp_test.go +++ b/orm/encoding/ormfield/timestamp_test.go @@ -114,7 +114,6 @@ func TestTimestampOutOfRange(t *testing.T) { }, } for _, tc := range tt { - tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() val := protoreflect.ValueOfMessage(tc.ts.ProtoReflect()) diff --git a/runtime/app.go b/runtime/app.go index f9a74a29a208..e2aa5798dac5 100644 --- a/runtime/app.go +++ b/runtime/app.go @@ -45,7 +45,7 @@ type App struct { ModuleManager *module.Manager UnorderedTxManager *unorderedtx.Manager - configurator module.Configurator // nolint:staticcheck // SA1019: Configurator is deprecated but still used in runtime v1. + configurator module.Configurator //nolint:staticcheck // SA1019: Configurator is deprecated but still used in runtime v1. config *runtimev1alpha1.Module storeKeys []storetypes.StoreKey interfaceRegistry codectypes.InterfaceRegistry @@ -251,7 +251,7 @@ func (a *App) RegisterNodeService(clientCtx client.Context, cfg config.Config) { } // Configurator returns the app's configurator. -func (a *App) Configurator() module.Configurator { // nolint:staticcheck // SA1019: Configurator is deprecated but still used in runtime v1. +func (a *App) Configurator() module.Configurator { //nolint:staticcheck // SA1019: Configurator is deprecated but still used in runtime v1. return a.configurator } diff --git a/runtime/module.go b/runtime/module.go index 95595fc209f8..773efe10a3e2 100644 --- a/runtime/module.go +++ b/runtime/module.go @@ -39,7 +39,7 @@ type appModule struct { func (m appModule) IsOnePerModuleType() {} func (m appModule) IsAppModule() {} -func (m appModule) RegisterServices(configurator module.Configurator) { // nolint:staticcheck // SA1019: Configurator is deprecated but still used in runtime v1. +func (m appModule) RegisterServices(configurator module.Configurator) { //nolint:staticcheck // SA1019: Configurator is deprecated but still used in runtime v1. err := m.app.registerRuntimeServices(configurator) if err != nil { panic(err) diff --git a/runtime/services.go b/runtime/services.go index 2f453898ff88..c36f7e3e0331 100644 --- a/runtime/services.go +++ b/runtime/services.go @@ -8,7 +8,7 @@ import ( "github.com/cosmos/cosmos-sdk/types/module" ) -func (a *App) registerRuntimeServices(cfg module.Configurator) error { // nolint:staticcheck // SA1019: Configurator is deprecated but still used in runtime v1. +func (a *App) registerRuntimeServices(cfg module.Configurator) error { //nolint:staticcheck // SA1019: Configurator is deprecated but still used in runtime v1. autocliv1.RegisterQueryServer(cfg.QueryServer(), services.NewAutoCLIQueryService(a.ModuleManager.Modules)) reflectionSvc, err := services.NewReflectionService() diff --git a/runtime/services/autocli.go b/runtime/services/autocli.go index c6b66e510d62..cd2005690d1e 100644 --- a/runtime/services/autocli.go +++ b/runtime/services/autocli.go @@ -105,7 +105,7 @@ type autocliConfigurator struct { err error } -var _ module.Configurator = &autocliConfigurator{} // nolint:staticcheck // SA1019: Configurator is deprecated but still used in runtime v1. +var _ module.Configurator = &autocliConfigurator{} //nolint:staticcheck // SA1019: Configurator is deprecated but still used in runtime v1. func (a *autocliConfigurator) MsgServer() gogogrpc.Server { return &a.msgServer } diff --git a/runtime/v2/manager.go b/runtime/v2/manager.go index eea180843800..1ce4aeba4663 100644 --- a/runtime/v2/manager.go +++ b/runtime/v2/manager.go @@ -577,7 +577,6 @@ func (m *MM[T]) assertNoForgottenModules( } var missing []string for m := range m.modules { - m := m if pass != nil && pass(m) { continue } diff --git a/schema/appdata/mux.go b/schema/appdata/mux.go index 81a4fa795db8..1eab8b69a6fe 100644 --- a/schema/appdata/mux.go +++ b/schema/appdata/mux.go @@ -139,7 +139,7 @@ func ListenerMux(listeners ...Listener) Listener { mux.onBatch = func(batch PacketBatch) error { for _, listener := range listeners { - err := batch.apply(&listener) + err := batch.apply(&listener) //nolint:gosec // aliasing is safe here if err != nil { return err } diff --git a/schema/diff/diff_test.go b/schema/diff/diff_test.go index 2785afc575e3..d4f4c56ca698 100644 --- a/schema/diff/diff_test.go +++ b/schema/diff/diff_test.go @@ -332,6 +332,8 @@ func TestCompareModuleSchemas(t *testing.T) { } func requireModuleSchema(t *testing.T, types ...schema.Type) schema.ModuleSchema { + t.Helper() + s, err := schema.CompileModuleSchema(types...) if err != nil { t.Fatal(err) diff --git a/schema/field.go b/schema/field.go index 0d762aa58dc6..dfbae6ed1b97 100644 --- a/schema/field.go +++ b/schema/field.go @@ -75,7 +75,7 @@ func (c Field) ValidateValue(value interface{}, typeSet TypeSet) error { } err := enumType.ValidateValue(value.(string)) if err != nil { - return fmt.Errorf("invalid value for enum field %q: %v", c.Name, err) + return fmt.Errorf("invalid value for enum field %q: %v", c.Name, err) //nolint:errorlint // false positive due to using go1.12 } default: } diff --git a/schema/testing/appdatasim/app_data_test.go b/schema/testing/appdatasim/app_data_test.go index eba8a8984ffb..146f9a398e98 100644 --- a/schema/testing/appdatasim/app_data_test.go +++ b/schema/testing/appdatasim/app_data_test.go @@ -24,7 +24,7 @@ func TestAppSimulator_mirror(t *testing.T) { }) } -func testAppSimulatorMirror(t *testing.T, retainDeletes bool) { // nolint: thelper // this isn't a test helper function +func testAppSimulatorMirror(t *testing.T, retainDeletes bool) { //nolint: thelper // this isn't a test helper function stateSimOpts := statesim.Options{CanRetainDeletions: retainDeletes} mirror, err := NewSimulator(Options{ StateSimOptions: stateSimOpts, diff --git a/scripts/build/linting.mk b/scripts/build/linting.mk index 6e723c5f84f7..d174a06372f7 100644 --- a/scripts/build/linting.mk +++ b/scripts/build/linting.mk @@ -1,4 +1,4 @@ -golangci_version=v1.60.1 +golangci_version=v1.61.0 golangci_installed_version=$(shell golangci-lint version --format short 2>/dev/null) #? setup-pre-commit: Set pre-commit git hook diff --git a/server/grpc/gogoreflection/fix_registration.go b/server/grpc/gogoreflection/fix_registration.go index ab1a18f592e9..5704f054ff61 100644 --- a/server/grpc/gogoreflection/fix_registration.go +++ b/server/grpc/gogoreflection/fix_registration.go @@ -3,10 +3,9 @@ package gogoreflection import ( "reflect" + _ "github.com/cosmos/cosmos-proto" // look above _ "github.com/cosmos/gogoproto/gogoproto" // required so it does register the gogoproto file descriptor gogoproto "github.com/cosmos/gogoproto/proto" - - _ "github.com/cosmos/cosmos-proto" // look above "github.com/golang/protobuf/proto" //nolint:staticcheck // migrate in a future pr ) @@ -42,12 +41,12 @@ func getExtension(extID int32, m proto.Message) *gogoproto.ExtensionDesc { for id, desc := range proto.RegisteredExtensions(m) { //nolint:staticcheck // keep for backward compatibility if id == extID { return &gogoproto.ExtensionDesc{ - ExtendedType: desc.ExtendedType, //nolint:staticcheck // keep for backward compatibility - ExtensionType: desc.ExtensionType, //nolint:staticcheck // keep for backward compatibility - Field: desc.Field, //nolint:staticcheck // keep for backward compatibility - Name: desc.Name, //nolint:staticcheck // keep for backward compatibility - Tag: desc.Tag, //nolint:staticcheck // keep for backward compatibility - Filename: desc.Filename, //nolint:staticcheck // keep for backward compatibility + ExtendedType: desc.ExtendedType, + ExtensionType: desc.ExtensionType, + Field: desc.Field, + Name: desc.Name, + Tag: desc.Tag, + Filename: desc.Filename, } } } diff --git a/server/grpc/gogoreflection/serverreflection.go b/server/grpc/gogoreflection/serverreflection.go index 559548cb31b3..11213a19d82f 100644 --- a/server/grpc/gogoreflection/serverreflection.go +++ b/server/grpc/gogoreflection/serverreflection.go @@ -184,7 +184,7 @@ func fqn(prefix, name string) string { // fileDescForType gets the file descriptor for the given type. // The given type should be a proto message. func (s *serverReflectionServer) fileDescForType(st reflect.Type) (*dpb.FileDescriptorProto, error) { - m, ok := reflect.Zero(reflect.PtrTo(st)).Interface().(protoMessage) + m, ok := reflect.Zero(reflect.PointerTo(st)).Interface().(protoMessage) if !ok { return nil, fmt.Errorf("failed to create message from type: %v", st) } @@ -232,7 +232,7 @@ func typeForName(name string) (reflect.Type, error) { } func fileDescContainingExtension(st reflect.Type, ext int32) (*dpb.FileDescriptorProto, error) { - m, ok := reflect.Zero(reflect.PtrTo(st)).Interface().(proto.Message) + m, ok := reflect.Zero(reflect.PointerTo(st)).Interface().(proto.Message) if !ok { return nil, fmt.Errorf("failed to create message from type: %v", st) } @@ -247,7 +247,7 @@ func fileDescContainingExtension(st reflect.Type, ext int32) (*dpb.FileDescripto } func (s *serverReflectionServer) allExtensionNumbersForType(st reflect.Type) ([]int32, error) { - m, ok := reflect.Zero(reflect.PtrTo(st)).Interface().(proto.Message) + m, ok := reflect.Zero(reflect.PointerTo(st)).Interface().(proto.Message) if !ok { return nil, fmt.Errorf("failed to create message from type: %v", st) } diff --git a/server/pruning_test.go b/server/pruning_test.go index 0c162fad61fe..08e1a6d0773c 100644 --- a/server/pruning_test.go +++ b/server/pruning_test.go @@ -49,8 +49,6 @@ func TestGetPruningOptionsFromFlags(t *testing.T) { } for _, tt := range tests { - tt := tt - t.Run(tt.name, func(j *testing.T) { viper.Reset() viper.SetDefault(FlagPruning, pruningtypes.PruningOptionDefault) diff --git a/server/start.go b/server/start.go index dce5ae198e6a..65822e60338e 100644 --- a/server/start.go +++ b/server/start.go @@ -832,7 +832,7 @@ func testnetify[T types.Application](ctx *Context, testnetAppCreator types.AppCr _, context := getCtx(ctx, true) clientCreator := proxy.NewLocalClientCreator(cmtApp) metrics := node.DefaultMetricsProvider(cmtcfg.DefaultConfig().Instrumentation) - _, _, _, _, _, proxyMetrics, _, _ := metrics(genDoc.ChainID) // nolint: dogsled // function from comet + _, _, _, _, _, proxyMetrics, _, _ := metrics(genDoc.ChainID) //nolint: dogsled // function from comet proxyApp := proxy.NewAppConns(clientCreator, proxyMetrics) if err := proxyApp.Start(); err != nil { return nil, fmt.Errorf("error starting proxy app connections: %w", err) diff --git a/server/v2/api/grpc/gogoreflection/fix_registration.go b/server/v2/api/grpc/gogoreflection/fix_registration.go index ab1a18f592e9..d4edfc62b5e7 100644 --- a/server/v2/api/grpc/gogoreflection/fix_registration.go +++ b/server/v2/api/grpc/gogoreflection/fix_registration.go @@ -3,10 +3,9 @@ package gogoreflection import ( "reflect" + _ "github.com/cosmos/cosmos-proto" // look above _ "github.com/cosmos/gogoproto/gogoproto" // required so it does register the gogoproto file descriptor gogoproto "github.com/cosmos/gogoproto/proto" - - _ "github.com/cosmos/cosmos-proto" // look above "github.com/golang/protobuf/proto" //nolint:staticcheck // migrate in a future pr ) @@ -42,12 +41,12 @@ func getExtension(extID int32, m proto.Message) *gogoproto.ExtensionDesc { for id, desc := range proto.RegisteredExtensions(m) { //nolint:staticcheck // keep for backward compatibility if id == extID { return &gogoproto.ExtensionDesc{ - ExtendedType: desc.ExtendedType, //nolint:staticcheck // keep for backward compatibility - ExtensionType: desc.ExtensionType, //nolint:staticcheck // keep for backward compatibility - Field: desc.Field, //nolint:staticcheck // keep for backward compatibility - Name: desc.Name, //nolint:staticcheck // keep for backward compatibility - Tag: desc.Tag, //nolint:staticcheck // keep for backward compatibility - Filename: desc.Filename, //nolint:staticcheck // keep for backward compatibility + ExtendedType: desc.ExtendedType, + ExtensionType: desc.ExtensionType, + Field: desc.Field, + Name: desc.Name, + Tag: desc.Tag, + Filename: desc.Filename, } } } diff --git a/server/v2/api/grpc/gogoreflection/serverreflection.go b/server/v2/api/grpc/gogoreflection/serverreflection.go index 79f520545a87..5bd26b467e00 100644 --- a/server/v2/api/grpc/gogoreflection/serverreflection.go +++ b/server/v2/api/grpc/gogoreflection/serverreflection.go @@ -188,7 +188,7 @@ func fqn(prefix, name string) string { // fileDescForType gets the file descriptor for the given type. // The given type should be a proto message. func (s *serverReflectionServer) fileDescForType(st reflect.Type) (*dpb.FileDescriptorProto, error) { - m, ok := reflect.Zero(reflect.PtrTo(st)).Interface().(protoMessage) + m, ok := reflect.Zero(reflect.PointerTo(st)).Interface().(protoMessage) if !ok { return nil, fmt.Errorf("failed to create message from type: %v", st) } @@ -236,7 +236,7 @@ func typeForName(name string) (reflect.Type, error) { } func fileDescContainingExtension(st reflect.Type, ext int32) (*dpb.FileDescriptorProto, error) { - m, ok := reflect.Zero(reflect.PtrTo(st)).Interface().(gogoproto.Message) + m, ok := reflect.Zero(reflect.PointerTo(st)).Interface().(gogoproto.Message) if !ok { return nil, fmt.Errorf("failed to create message from type: %v", st) } @@ -251,7 +251,7 @@ func fileDescContainingExtension(st reflect.Type, ext int32) (*dpb.FileDescripto } func (s *serverReflectionServer) allExtensionNumbersForType(st reflect.Type) ([]int32, error) { - m, ok := reflect.Zero(reflect.PtrTo(st)).Interface().(gogoproto.Message) + m, ok := reflect.Zero(reflect.PointerTo(st)).Interface().(gogoproto.Message) if !ok { return nil, fmt.Errorf("failed to create message from type: %v", st) } diff --git a/server/v2/api/telemetry/metrics.go b/server/v2/api/telemetry/metrics.go index 39055af6739b..75e857bb8ec4 100644 --- a/server/v2/api/telemetry/metrics.go +++ b/server/v2/api/telemetry/metrics.go @@ -17,7 +17,7 @@ import ( // GlobalLabels defines the set of global labels that will be applied to all // metrics emitted using the telemetry package function wrappers. -var GlobalLabels = []metrics.Label{} // nolint: ignore // false positive +var GlobalLabels = []metrics.Label{} //nolint: ignore // false positive // NewLabel creates a new instance of Label with name and value func NewLabel(name, value string) metrics.Label { diff --git a/server/v2/cometbft/abci_test.go b/server/v2/cometbft/abci_test.go index 0a4f1b16f975..76aee699f5b0 100644 --- a/server/v2/cometbft/abci_test.go +++ b/server/v2/cometbft/abci_test.go @@ -334,9 +334,6 @@ func TestConsensus_ExtendVote(t *testing.T) { Block: &v1.BlockParams{ MaxGas: 5000000, }, - Abci: &v1.ABCIParams{ - VoteExtensionsEnableHeight: 2, - }, Feature: &v1.FeatureParams{ VoteExtensionsEnableHeight: &gogotypes.Int64Value{Value: 2}, }, @@ -376,9 +373,6 @@ func TestConsensus_VerifyVoteExtension(t *testing.T) { Block: &v1.BlockParams{ MaxGas: 5000000, }, - Abci: &v1.ABCIParams{ - VoteExtensionsEnableHeight: 2, - }, Feature: &v1.FeatureParams{ VoteExtensionsEnableHeight: &gogotypes.Int64Value{Value: 2}, }, @@ -537,6 +531,7 @@ func TestConsensus_ProcessProposal_With_Handler(t *testing.T) { Height: 1, Txs: [][]byte{mockTx.Bytes(), append(mockTx.Bytes(), []byte("bad")...), mockTx.Bytes(), mockTx.Bytes()}, }) + require.NoError(t, err) require.Equal(t, res.Status, abciproto.PROCESS_PROPOSAL_STATUS_REJECT) } @@ -642,9 +637,6 @@ func setUpConsensus(t *testing.T, gasLimit uint64, mempool mempool.Mempool[mock. Block: &v1.BlockParams{ MaxGas: 300000, }, - Abci: &v1.ABCIParams{ - VoteExtensionsEnableHeight: 2, - }, Feature: &v1.FeatureParams{ VoteExtensionsEnableHeight: &gogotypes.Int64Value{Value: 2}, }, diff --git a/server/v2/server.go b/server/v2/server.go index d1062618ab60..7ee91e649982 100644 --- a/server/v2/server.go +++ b/server/v2/server.go @@ -89,7 +89,6 @@ func (s *Server[T]) Start(ctx context.Context) error { g, ctx := errgroup.WithContext(ctx) for _, mod := range s.components { - mod := mod g.Go(func() error { return mod.Start(ctx) }) @@ -110,7 +109,6 @@ func (s *Server[T]) Stop(ctx context.Context) error { g, ctx := errgroup.WithContext(ctx) for _, mod := range s.components { - mod := mod g.Go(func() error { return mod.Stop(ctx) }) @@ -198,7 +196,6 @@ func (s *Server[T]) Init(appI AppI[T], cfg map[string]any, logger log.Logger) er var components []ServerComponent[T] for _, mod := range s.components { - mod := mod if err := mod.Init(appI, cfg, logger); err != nil { return err } diff --git a/simapp/app.go b/simapp/app.go index d7309c890611..a110e267c84a 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -183,7 +183,7 @@ type SimApp struct { sm *module.SimulationManager // module configurator - configurator module.Configurator // nolint:staticcheck // SA1019: Configurator is deprecated but still used in runtime v1. + configurator module.Configurator //nolint:staticcheck // SA1019: Configurator is deprecated but still used in runtime v1. } func init() { @@ -705,7 +705,7 @@ func (app *SimApp) EndBlocker(ctx sdk.Context) (sdk.EndBlock, error) { return app.ModuleManager.EndBlock(ctx) } -func (a *SimApp) Configurator() module.Configurator { // nolint:staticcheck // SA1019: Configurator is deprecated but still used in runtime v1. +func (a *SimApp) Configurator() module.Configurator { //nolint:staticcheck // SA1019: Configurator is deprecated but still used in runtime v1. return a.configurator } diff --git a/simapp/genesis_account_test.go b/simapp/genesis_account_test.go index d813e9ec7e31..eccb8cc66c6e 100644 --- a/simapp/genesis_account_test.go +++ b/simapp/genesis_account_test.go @@ -81,7 +81,6 @@ func TestSimGenesisAccountValidate(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { require.Equal(t, tc.wantErr, tc.sga.Validate() != nil) }) diff --git a/simapp/v2/genesis_account_test.go b/simapp/v2/genesis_account_test.go index 5b8339b29c0b..d5f80a702b05 100644 --- a/simapp/v2/genesis_account_test.go +++ b/simapp/v2/genesis_account_test.go @@ -81,7 +81,6 @@ func TestSimGenesisAccountValidate(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { require.Equal(t, tc.wantErr, tc.sga.Validate() != nil) }) diff --git a/store/cachekv/search_test.go b/store/cachekv/search_test.go index 41321c076eae..aedc0669030a 100644 --- a/store/cachekv/search_test.go +++ b/store/cachekv/search_test.go @@ -60,7 +60,6 @@ func TestFindStartIndex(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { body := tt.sortedL got := findStartIndex(body, tt.query) @@ -129,7 +128,6 @@ func TestFindEndIndex(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { body := tt.sortedL got := findEndIndex(body, tt.query) diff --git a/store/cachekv/store.go b/store/cachekv/store.go index bce28e4b2d3f..3509cef6aee3 100644 --- a/store/cachekv/store.go +++ b/store/cachekv/store.go @@ -300,7 +300,7 @@ func (store *Store) dirtyItems(start, end []byte) { } n := len(store.unsortedCache) - unsorted := make([]*kv.Pair, 0) + unsorted := make([]*kv.Pair, 0) //nolint:staticcheck // We are in store v1. // If the unsortedCache is too big, its costs too much to determine // what's in the subset we are concerned about. // If you are interleaving iterator calls with writes, this can easily become an @@ -312,7 +312,7 @@ func (store *Store) dirtyItems(start, end []byte) { // dbm.IsKeyInDomain is nil safe and returns true iff key is greater than start if dbm.IsKeyInDomain(conv.UnsafeStrToBytes(key), start, end) { cacheValue := store.cache[key] - unsorted = append(unsorted, &kv.Pair{Key: []byte(key), Value: cacheValue.value}) + unsorted = append(unsorted, &kv.Pair{Key: []byte(key), Value: cacheValue.value}) //nolint:staticcheck // We are in store v1. } } store.clearUnsortedCacheSubset(unsorted, stateUnsorted) @@ -355,18 +355,18 @@ func (store *Store) dirtyItems(start, end []byte) { } } - kvL := make([]*kv.Pair, 0, 1+endIndex-startIndex) + kvL := make([]*kv.Pair, 0, 1+endIndex-startIndex) //nolint:staticcheck // We are in store v1. for i := startIndex; i <= endIndex; i++ { key := strL[i] cacheValue := store.cache[key] - kvL = append(kvL, &kv.Pair{Key: []byte(key), Value: cacheValue.value}) + kvL = append(kvL, &kv.Pair{Key: []byte(key), Value: cacheValue.value}) //nolint:staticcheck // We are in store v1. } // kvL was already sorted so pass it in as is. store.clearUnsortedCacheSubset(kvL, stateAlreadySorted) } -func (store *Store) clearUnsortedCacheSubset(unsorted []*kv.Pair, sortState sortState) { +func (store *Store) clearUnsortedCacheSubset(unsorted []*kv.Pair, sortState sortState) { //nolint:staticcheck // We are in store v1. n := len(store.unsortedCache) if len(unsorted) == n { // This pattern allows the Go compiler to emit the map clearing idiom for the entire map. for key := range store.unsortedCache { diff --git a/store/cachekv/store_test.go b/store/cachekv/store_test.go index f48f919c3504..2885e7125476 100644 --- a/store/cachekv/store_test.go +++ b/store/cachekv/store_test.go @@ -475,6 +475,10 @@ func doOp(t *testing.T, st types.CacheKVStore, truth corestore.KVStoreWithBatch, err := truth.Set(keyFmt(k), valFmt(k)) require.NoError(t, err) case opSetRange: + if len(args) < 2 { + panic("expected 2 args") + } + start := args[0] end := args[1] setRange(t, st, truth, start, end) @@ -484,6 +488,10 @@ func doOp(t *testing.T, st types.CacheKVStore, truth corestore.KVStoreWithBatch, err := truth.Delete(keyFmt(k)) require.NoError(t, err) case opDelRange: + if len(args) < 2 { + panic("expected 2 args") + } + start := args[0] end := args[1] deleteRange(t, st, truth, start, end) diff --git a/store/iavl/store.go b/store/iavl/store.go index 789e7c5d5eb1..ae6b0b56ff70 100644 --- a/store/iavl/store.go +++ b/store/iavl/store.go @@ -361,8 +361,8 @@ func (st *Store) Query(req *types.RequestQuery) (res *types.ResponseQuery, err e res.ProofOps = getProofFromTree(mtree, req.Data, res.Value != nil) case "/subspace": - pairs := kv.Pairs{ - Pairs: make([]kv.Pair, 0), + pairs := kv.Pairs{ //nolint:staticcheck // We are in store v1. + Pairs: make([]kv.Pair, 0), //nolint:staticcheck // We are in store v1. } subspace := req.Data @@ -370,7 +370,7 @@ func (st *Store) Query(req *types.RequestQuery) (res *types.ResponseQuery, err e iterator := types.KVStorePrefixIterator(st, subspace) for ; iterator.Valid(); iterator.Next() { - pairs.Pairs = append(pairs.Pairs, kv.Pair{Key: iterator.Key(), Value: iterator.Value()}) + pairs.Pairs = append(pairs.Pairs, kv.Pair{Key: iterator.Key(), Value: iterator.Value()}) //nolint:staticcheck // We are in store v1. } if err := iterator.Close(); err != nil { panic(fmt.Errorf("failed to close iterator: %w", err)) diff --git a/store/iavl/store_test.go b/store/iavl/store_test.go index ab6abbde05a6..d0339c59a107 100644 --- a/store/iavl/store_test.go +++ b/store/iavl/store_test.go @@ -478,15 +478,15 @@ func TestIAVLStoreQuery(t *testing.T) { v3 := []byte("val3") ksub := []byte("key") - KVs0 := kv.Pairs{} - KVs1 := kv.Pairs{ - Pairs: []kv.Pair{ + KVs0 := kv.Pairs{} //nolint:staticcheck // We are in store v1. + KVs1 := kv.Pairs{ //nolint:staticcheck // We are in store v1. + Pairs: []kv.Pair{ //nolint:staticcheck // We are in store v1. {Key: k1, Value: v1}, {Key: k2, Value: v2}, }, } - KVs2 := kv.Pairs{ - Pairs: []kv.Pair{ + KVs2 := kv.Pairs{ //nolint:staticcheck // We are in store v1. + Pairs: []kv.Pair{ //nolint:staticcheck // We are in store v1. {Key: k1, Value: v3}, {Key: k2, Value: v2}, }, @@ -639,8 +639,6 @@ func TestSetInitialVersion(t *testing.T) { } for _, tc := range testCases { - tc := tc - t.Run(tc.name, func(t *testing.T) { db := coretesting.NewMemDB() store := tc.storeFn(db) diff --git a/store/internal/maps/maps.go b/store/internal/maps/maps.go index 6db2be666cae..f2c6117c737b 100644 --- a/store/internal/maps/maps.go +++ b/store/internal/maps/maps.go @@ -14,13 +14,13 @@ import ( // merkleMap defines a merkle-ized tree from a map. Leave values are treated as // hash(key) | hash(value). Leaves are sorted before Merkle hashing. type merkleMap struct { - kvs kv.Pairs + kvs kv.Pairs //nolint:staticcheck // We are in store v1. sorted bool } func newMerkleMap() *merkleMap { return &merkleMap{ - kvs: kv.Pairs{}, + kvs: kv.Pairs{}, //nolint:staticcheck // We are in store v1. sorted: false, } } @@ -38,7 +38,7 @@ func (sm *merkleMap) set(key string, value []byte) { // and make a determination to fetch or not. vhash := sha256.Sum256(value) - sm.kvs.Pairs = append(sm.kvs.Pairs, kv.Pair{ + sm.kvs.Pairs = append(sm.kvs.Pairs, kv.Pair{ //nolint:staticcheck // We are in store v1. Key: byteKey, Value: vhash[:], }) @@ -61,7 +61,7 @@ func (sm *merkleMap) sort() { // hashKVPairs hashes a kvPair and creates a merkle tree where the leaves are // byte slices. -func hashKVPairs(kvs kv.Pairs) []byte { +func hashKVPairs(kvs kv.Pairs) []byte { //nolint:staticcheck // We are in store v1. kvsH := make([][]byte, len(kvs.Pairs)) for i, kvp := range kvs.Pairs { kvsH[i] = KVPair(kvp).Bytes() @@ -76,13 +76,13 @@ func hashKVPairs(kvs kv.Pairs) []byte { // Leaves are `hash(key) | hash(value)`. // Leaves are sorted before Merkle hashing. type simpleMap struct { - Kvs kv.Pairs + Kvs kv.Pairs //nolint:staticcheck // We are in store v1. sorted bool } func newSimpleMap() *simpleMap { return &simpleMap{ - Kvs: kv.Pairs{}, + Kvs: kv.Pairs{}, //nolint:staticcheck // We are in store v1. sorted: false, } } @@ -99,7 +99,7 @@ func (sm *simpleMap) Set(key string, value []byte) { // and make a determination to fetch or not. vhash := sha256.Sum256(value) - sm.Kvs.Pairs = append(sm.Kvs.Pairs, kv.Pair{ + sm.Kvs.Pairs = append(sm.Kvs.Pairs, kv.Pair{ //nolint:staticcheck // We are in store v1. Key: byteKey, Value: vhash[:], }) @@ -122,10 +122,10 @@ func (sm *simpleMap) Sort() { // KVPairs returns a copy of sorted KVPairs. // NOTE these contain the hashed key and value. -func (sm *simpleMap) KVPairs() kv.Pairs { +func (sm *simpleMap) KVPairs() kv.Pairs { //nolint:staticcheck // We are in store v1. sm.Sort() - kvs := kv.Pairs{ - Pairs: make([]kv.Pair, len(sm.Kvs.Pairs)), + kvs := kv.Pairs{ //nolint:staticcheck // We are in store v1. + Pairs: make([]kv.Pair, len(sm.Kvs.Pairs)), //nolint:staticcheck // We are in store v1. } copy(kvs.Pairs, sm.Kvs.Pairs) @@ -137,12 +137,12 @@ func (sm *simpleMap) KVPairs() kv.Pairs { // KVPair is a local extension to KVPair that can be hashed. // Key and value are length prefixed and concatenated, // then hashed. -type KVPair kv.Pair +type KVPair kv.Pair //nolint:staticcheck // We are in store v1. // NewKVPair takes in a key and value and creates a kv.Pair // wrapped in the local extension KVPair func NewKVPair(key, value []byte) KVPair { - return KVPair(kv.Pair{ + return KVPair(kv.Pair{ //nolint:staticcheck // We are in store v1. Key: key, Value: value, }) diff --git a/store/listenkv/store_test.go b/store/listenkv/store_test.go index 3425097db100..7b1b17fd6755 100644 --- a/store/listenkv/store_test.go +++ b/store/listenkv/store_test.go @@ -19,7 +19,7 @@ func bz(s string) []byte { return []byte(s) } func keyFmt(i int) []byte { return bz(fmt.Sprintf("key%0.8d", i)) } func valFmt(i int) []byte { return bz(fmt.Sprintf("value%0.8d", i)) } -var kvPairs = []kv.Pair{ +var kvPairs = []kv.Pair{ //nolint:staticcheck // We are in store v1. {Key: keyFmt(1), Value: valFmt(1)}, {Key: keyFmt(2), Value: valFmt(2)}, {Key: keyFmt(3), Value: valFmt(3)}, diff --git a/store/pruning/manager_test.go b/store/pruning/manager_test.go index 19cbe5deb42f..0f62a36c5b07 100644 --- a/store/pruning/manager_test.go +++ b/store/pruning/manager_test.go @@ -75,7 +75,7 @@ func TestStrategies(t *testing.T) { } for name, tc := range testcases { - tc := tc // Local copy to avoid shadowing. + // Local copy to avoid shadowing. t.Run(name, func(t *testing.T) { t.Parallel() diff --git a/store/rootmulti/snapshot_test.go b/store/rootmulti/snapshot_test.go index 35a2a0c569f7..fc00f5be25d9 100644 --- a/store/rootmulti/snapshot_test.go +++ b/store/rootmulti/snapshot_test.go @@ -142,7 +142,6 @@ func TestMultistoreSnapshot_Checksum(t *testing.T) { }}, } for _, tc := range testcases { - tc := tc t.Run(fmt.Sprintf("Format %v", tc.format), func(t *testing.T) { ch := make(chan io.ReadCloser) go func() { @@ -177,7 +176,6 @@ func TestMultistoreSnapshot_Errors(t *testing.T) { "unknown height": {9, nil}, } for name, tc := range testcases { - tc := tc t.Run(name, func(t *testing.T) { err := store.Snapshot(tc.height, nil) require.Error(t, err) diff --git a/store/rootmulti/store_test.go b/store/rootmulti/store_test.go index cd2029a5f707..31d24ed1205c 100644 --- a/store/rootmulti/store_test.go +++ b/store/rootmulti/store_test.go @@ -524,8 +524,6 @@ func TestMultiStore_Pruning(t *testing.T) { } for _, tc := range testCases { - tc := tc - t.Run(tc.name, func(t *testing.T) { db := coretesting.NewMemDB() ms := newMultiStoreWithMounts(db, tc.po) diff --git a/store/tracekv/store_test.go b/store/tracekv/store_test.go index ae4136cce87f..5ad933cb67b0 100644 --- a/store/tracekv/store_test.go +++ b/store/tracekv/store_test.go @@ -21,7 +21,7 @@ func bz(s string) []byte { return []byte(s) } func keyFmt(i int) []byte { return bz(fmt.Sprintf("key%0.8d", i)) } func valFmt(i int) []byte { return bz(fmt.Sprintf("value%0.8d", i)) } -var kvPairs = []kv.Pair{ +var kvPairs = []kv.Pair{ //nolint:staticcheck // We are in store v1. {Key: keyFmt(1), Value: valFmt(1)}, {Key: keyFmt(2), Value: valFmt(2)}, {Key: keyFmt(3), Value: valFmt(3)}, diff --git a/store/types/gas_test.go b/store/types/gas_test.go index f4b5a6abe5ba..a4f63ab6d999 100644 --- a/store/types/gas_test.go +++ b/store/types/gas_test.go @@ -47,7 +47,6 @@ func TestGasMeter(t *testing.T) { used := uint64(0) for unum, usage := range tc.usage { - usage := usage used += usage require.NotPanics(t, func() { meter.ConsumeGas(usage, "") }, "Not exceeded limit but panicked. tc #%d, usage #%d", tcnum, unum) require.Equal(t, used, meter.GasConsumed(), "Gas consumption not match. tc #%d, usage #%d", tcnum, unum) diff --git a/store/types/iterator_test.go b/store/types/iterator_test.go index e520acd85792..f8a1af65b83a 100644 --- a/store/types/iterator_test.go +++ b/store/types/iterator_test.go @@ -84,7 +84,6 @@ func TestPaginatedIterator(t *testing.T) { reverse: true, }, } { - tc := tc t.Run(tc.desc, func(t *testing.T) { var iter types.Iterator if tc.reverse { diff --git a/store/types/store_test.go b/store/types/store_test.go index b6304d131bc2..4a77c7babea8 100644 --- a/store/types/store_test.go +++ b/store/types/store_test.go @@ -53,7 +53,6 @@ func TestStoreUpgrades(t *testing.T) { } for name, tc := range cases { - tc := tc t.Run(name, func(t *testing.T) { for _, r := range tc.expectAdd { assert.Equal(t, tc.upgrades.IsAdded(r.key), true) diff --git a/store/v2/root/store_test.go b/store/v2/root/store_test.go index eddaea730652..e8cf34e014e0 100644 --- a/store/v2/root/store_test.go +++ b/store/v2/root/store_test.go @@ -456,7 +456,6 @@ func (s *RootStoreTestSuite) TestPrune() { } for _, tc := range testCases { - tc := tc s.newStoreWithPruneConfig(&tc.po) diff --git a/tests/e2e/auth/suite.go b/tests/e2e/auth/suite.go index 544fef1683b4..31dca150f87e 100644 --- a/tests/e2e/auth/suite.go +++ b/tests/e2e/auth/suite.go @@ -357,7 +357,6 @@ func (s *E2ETestSuite) TestCLIQueryTxCmdByHash() { } for _, tc := range testCases { - tc := tc s.Run(tc.name, func() { cmd := authcli.QueryTxCmd() clientCtx := val.GetClientCtx() @@ -490,7 +489,6 @@ func (s *E2ETestSuite) TestCLIQueryTxCmdByEvents() { } for _, tc := range testCases { - tc := tc s.Run(tc.name, func() { cmd := authcli.QueryTxCmd() clientCtx := val.GetClientCtx() @@ -570,7 +568,6 @@ func (s *E2ETestSuite) TestCLIQueryTxsCmdByEvents() { } for _, tc := range testCases { - tc := tc s.Run(tc.name, func() { cmd := authcli.QueryTxsByEventsCmd() clientCtx := val.GetClientCtx() @@ -1503,7 +1500,6 @@ func (s *E2ETestSuite) TestAuxSigner() { } for _, tc := range testCases { - tc := tc s.Run(tc.name, func() { _, err := govtestutil.MsgSubmitLegacyProposal( val.GetClientCtx(), @@ -1730,7 +1726,6 @@ func (s *E2ETestSuite) TestAuxToFeeWithTips() { } for _, tc := range testCases { - tc := tc s.Run(tc.name, func() { res, err := govtestutil.MsgSubmitLegacyProposal( val.GetClientCtx(), diff --git a/tests/e2e/authz/grpc.go b/tests/e2e/authz/grpc.go index e8b9c3487e25..d06c85bb024c 100644 --- a/tests/e2e/authz/grpc.go +++ b/tests/e2e/authz/grpc.go @@ -63,7 +63,6 @@ func (s *E2ETestSuite) TestQueryGrantGRPC() { }, } for _, tc := range testCases { - tc := tc s.Run(tc.name, func() { resp, _ := testutil.GetRequest(tc.url) require := s.Require() @@ -151,7 +150,6 @@ func (s *E2ETestSuite) TestQueryGrantsGRPC() { }, } for _, tc := range testCases { - tc := tc s.Run(tc.name, func() { tc.preRun() resp, err := testutil.GetRequest(tc.url) diff --git a/tests/e2e/authz/tx.go b/tests/e2e/authz/tx.go index 811cdf51ded5..bf8757c0777b 100644 --- a/tests/e2e/authz/tx.go +++ b/tests/e2e/authz/tx.go @@ -305,7 +305,6 @@ func (s *E2ETestSuite) TestNewExecGenericAuthorized() { } for _, tc := range testCases { - tc := tc s.Run(tc.name, func() { cmd := cli.NewCmdExecAuthorization() clientCtx := val.GetClientCtx() @@ -415,7 +414,6 @@ func (s *E2ETestSuite) TestNewExecGrantAuthorized() { } for _, tc := range testCases { - tc := tc s.Run(tc.name, func() { cmd := cli.NewCmdExecAuthorization() clientCtx := val.GetClientCtx() @@ -619,7 +617,6 @@ func (s *E2ETestSuite) TestExecDelegateAuthorization() { } for _, tc := range testCases { - tc := tc s.Run(tc.name, func() { cmd := cli.NewCmdExecAuthorization() clientCtx := val.GetClientCtx() @@ -686,7 +683,6 @@ func (s *E2ETestSuite) TestExecDelegateAuthorization() { } for _, tc := range testCases { - tc := tc s.Run(tc.name, func() { cmd := cli.NewCmdExecAuthorization() clientCtx := val.GetClientCtx() @@ -841,7 +837,6 @@ func (s *E2ETestSuite) TestExecUndelegateAuthorization() { } for _, tc := range testCases { - tc := tc s.Run(tc.name, func() { cmd := cli.NewCmdExecAuthorization() clientCtx := val.GetClientCtx() @@ -909,7 +904,6 @@ func (s *E2ETestSuite) TestExecUndelegateAuthorization() { } for _, tc := range testCases { - tc := tc s.Run(tc.name, func() { cmd := cli.NewCmdExecAuthorization() clientCtx := val.GetClientCtx() diff --git a/tests/e2e/client/grpc/cmtservice/service_test.go b/tests/e2e/client/grpc/cmtservice/service_test.go index a08c77ce4d1c..e4177a11edfb 100644 --- a/tests/e2e/client/grpc/cmtservice/service_test.go +++ b/tests/e2e/client/grpc/cmtservice/service_test.go @@ -154,7 +154,6 @@ func (s *E2ETestSuite) TestLatestValidatorSet_GRPC() { {"with pagination", &cmtservice.GetLatestValidatorSetRequest{Pagination: &qtypes.PageRequest{Offset: 0, Limit: uint64(len(vals))}}, false, ""}, } for _, tc := range testCases { - tc := tc s.Run(tc.name, func() { grpcRes, err := s.queryClient.GetLatestValidatorSet(context.Background(), tc.req) if tc.expErr { @@ -185,7 +184,6 @@ func (s *E2ETestSuite) TestLatestValidatorSet_GRPCGateway() { {"with pagination", fmt.Sprintf("%s/cosmos/base/tendermint/v1beta1/validatorsets/latest?pagination.offset=0&pagination.limit=2", vals[0].GetAPIAddress()), false, ""}, } for _, tc := range testCases { - tc := tc s.Run(tc.name, func() { res, err := testutil.GetRequest(tc.url) s.Require().NoError(err) @@ -218,7 +216,6 @@ func (s *E2ETestSuite) TestValidatorSetByHeight_GRPC() { {"with pagination", &cmtservice.GetValidatorSetByHeightRequest{Height: 1, Pagination: &qtypes.PageRequest{Offset: 0, Limit: 1}}, false, ""}, } for _, tc := range testCases { - tc := tc s.Run(tc.name, func() { grpcRes, err := s.queryClient.GetValidatorSetByHeight(context.Background(), tc.req) if tc.expErr { @@ -247,7 +244,6 @@ func (s *E2ETestSuite) TestValidatorSetByHeight_GRPCGateway() { {"with pagination", fmt.Sprintf("%s/cosmos/base/tendermint/v1beta1/validatorsets/%d?pagination.offset=0&pagination.limit=2", vals[0].GetAPIAddress(), 1), false, ""}, } for _, tc := range testCases { - tc := tc s.Run(tc.name, func() { res, err := testutil.GetRequest(tc.url) s.Require().NoError(err) @@ -326,8 +322,6 @@ func (s *E2ETestSuite) TestABCIQuery() { } for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { res, err := s.queryClient.ABCIQuery(context.Background(), tc.req) if tc.expectErr { diff --git a/tests/e2e/distribution/grpc_query_suite.go b/tests/e2e/distribution/grpc_query_suite.go index 4a5a2c3475b8..991567abfb4e 100644 --- a/tests/e2e/distribution/grpc_query_suite.go +++ b/tests/e2e/distribution/grpc_query_suite.go @@ -64,7 +64,7 @@ func (s *GRPCQueryTestSuite) TestQueryParamsGRPC() { } for _, tc := range testCases { - tc := tc + resp, err := sdktestutil.GetRequest(tc.url) s.Run(tc.name, func() { s.Require().NoError(err) @@ -99,7 +99,7 @@ func (s *GRPCQueryTestSuite) TestQueryValidatorDistributionInfoGRPC() { } for _, tc := range testCases { - tc := tc + resp, err := sdktestutil.GetRequest(tc.url) s.Run(tc.name, func() { if tc.expErr { @@ -152,7 +152,7 @@ func (s *GRPCQueryTestSuite) TestQueryOutstandingRewardsGRPC() { } for _, tc := range testCases { - tc := tc + resp, err := sdktestutil.GetRequestWithHeaders(tc.url, tc.headers) s.Run(tc.name, func() { if tc.expErr { @@ -206,7 +206,7 @@ func (s *GRPCQueryTestSuite) TestQueryValidatorCommissionGRPC() { } for _, tc := range testCases { - tc := tc + resp, err := sdktestutil.GetRequestWithHeaders(tc.url, tc.headers) s.Run(tc.name, func() { if tc.expErr { @@ -264,7 +264,7 @@ func (s *GRPCQueryTestSuite) TestQuerySlashesGRPC() { } for _, tc := range testCases { - tc := tc + resp, err := sdktestutil.GetRequest(tc.url) s.Run(tc.name, func() { @@ -340,7 +340,7 @@ func (s *GRPCQueryTestSuite) TestQueryDelegatorRewardsGRPC() { } for _, tc := range testCases { - tc := tc + resp, err := sdktestutil.GetRequestWithHeaders(tc.url, tc.headers) s.Run(tc.name, func() { @@ -392,7 +392,7 @@ func (s *GRPCQueryTestSuite) TestQueryDelegatorValidatorsGRPC() { } for _, tc := range testCases { - tc := tc + resp, err := sdktestutil.GetRequest(tc.url) s.Run(tc.name, func() { @@ -444,7 +444,7 @@ func (s *GRPCQueryTestSuite) TestQueryWithdrawAddressGRPC() { } for _, tc := range testCases { - tc := tc + resp, err := sdktestutil.GetRequest(tc.url) s.Run(tc.name, func() { diff --git a/tests/e2e/gov/tx.go b/tests/e2e/gov/tx.go index 3806e54a8823..9d6f84ce15aa 100644 --- a/tests/e2e/gov/tx.go +++ b/tests/e2e/gov/tx.go @@ -164,8 +164,6 @@ func (s *E2ETestSuite) TestNewCmdSubmitProposal() { } for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { cmd := cli.NewCmdSubmitProposal() clientCtx := val.GetClientCtx() @@ -260,8 +258,6 @@ func (s *E2ETestSuite) TestNewCmdSubmitLegacyProposal() { } for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { cmd := cli.NewCmdSubmitLegacyProposal() clientCtx := val.GetClientCtx() @@ -357,7 +353,6 @@ func (s *E2ETestSuite) TestNewCmdWeightedVote() { } for _, tc := range testCases { - tc := tc s.Run(tc.name, func() { cmd := cli.NewCmdWeightedVote() clientCtx := val.GetClientCtx() diff --git a/tests/e2e/tx/service_test.go b/tests/e2e/tx/service_test.go index b9e875f1173e..f0e4e527664c 100644 --- a/tests/e2e/tx/service_test.go +++ b/tests/e2e/tx/service_test.go @@ -175,7 +175,6 @@ func (s *E2ETestSuite) TestSimulateTx_GRPC() { } for _, tc := range testCases { - tc := tc s.Run(tc.name, func() { // Broadcast the tx via gRPC via the validator's clientCtx (which goes // through Tendermint). @@ -506,7 +505,6 @@ func (s *E2ETestSuite) TestBroadcastTx_GRPC() { } for _, tc := range testCases { - tc := tc s.Run(tc.name, func() { // Broadcast the tx via gRPC via the validator's clientCtx (which goes // through Tendermint). @@ -772,7 +770,6 @@ func (s *E2ETestSuite) TestTxEncode_GRPC() { } for _, tc := range testCases { - tc := tc s.Run(tc.name, func() { res, err := s.queryClient.TxEncode(context.Background(), tc.req) if tc.expErr { @@ -852,7 +849,6 @@ func (s *E2ETestSuite) TestTxDecode_GRPC() { } for _, tc := range testCases { - tc := tc s.Run(tc.name, func() { res, err := s.queryClient.TxDecode(context.Background(), tc.req) if tc.expErr { @@ -963,7 +959,6 @@ func (s *E2ETestSuite) TestTxEncodeAmino_GRPC() { } for _, tc := range testCases { - tc := tc s.Run(tc.name, func() { res, err := s.queryClient.TxEncodeAmino(context.Background(), tc.req) if tc.expErr { @@ -1049,7 +1044,6 @@ func (s *E2ETestSuite) TestTxDecodeAmino_GRPC() { } for _, tc := range testCases { - tc := tc s.Run(tc.name, func() { res, err := s.queryClient.TxDecodeAmino(context.Background(), tc.req) if tc.expErr { diff --git a/tests/integration/auth/client/cli/suite_test.go b/tests/integration/auth/client/cli/suite_test.go index b16d469ec445..ea2b929c5b31 100644 --- a/tests/integration/auth/client/cli/suite_test.go +++ b/tests/integration/auth/client/cli/suite_test.go @@ -274,7 +274,6 @@ func (s *CLITestSuite) TestCLIQueryTxCmdByHash() { } for _, tc := range testCases { - tc := tc s.Run(tc.name, func() { cmd := authcli.QueryTxCmd() cmd.SetArgs(tc.args) @@ -340,7 +339,6 @@ func (s *CLITestSuite) TestCLIQueryTxCmdByEvents() { } for _, tc := range testCases { - tc := tc s.Run(tc.name, func() { cmd := authcli.QueryTxCmd() cmd.SetArgs(tc.args) @@ -383,7 +381,6 @@ func (s *CLITestSuite) TestCLIQueryTxsCmdByEvents() { } for _, tc := range testCases { - tc := tc s.Run(tc.name, func() { cmd := authcli.QueryTxsByEventsCmd() @@ -1019,7 +1016,6 @@ func (s *CLITestSuite) TestAuxSigner() { } for _, tc := range testCases { - tc := tc s.Run(tc.name, func() { _, err := govtestutil.MsgSubmitLegacyProposal( s.clientCtx, @@ -1238,7 +1234,6 @@ func (s *CLITestSuite) TestAuxToFeeWithTips() { } for _, tc := range testCases { - tc := tc s.Run(tc.name, func() { res, err := govtestutil.MsgSubmitLegacyProposal( s.clientCtx, diff --git a/tests/integration/auth/keeper/msg_server_test.go b/tests/integration/auth/keeper/msg_server_test.go index d9985add6a61..daad9458b55a 100644 --- a/tests/integration/auth/keeper/msg_server_test.go +++ b/tests/integration/auth/keeper/msg_server_test.go @@ -250,7 +250,6 @@ func TestAsyncExec(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { res, err := f.app.RunMsg( tc.req, diff --git a/tests/integration/distribution/cli_tx_test.go b/tests/integration/distribution/cli_tx_test.go index 06f3012128db..0eb26d978c2f 100644 --- a/tests/integration/distribution/cli_tx_test.go +++ b/tests/integration/distribution/cli_tx_test.go @@ -111,8 +111,6 @@ func (s *CLITestSuite) TestTxWithdrawAllRewardsCmd() { } for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { cmd := cli.NewWithdrawAllRewardsCmd() diff --git a/tests/integration/distribution/keeper/msg_server_test.go b/tests/integration/distribution/keeper/msg_server_test.go index 575f031c14f7..7ab94c01a3e1 100644 --- a/tests/integration/distribution/keeper/msg_server_test.go +++ b/tests/integration/distribution/keeper/msg_server_test.go @@ -331,7 +331,6 @@ func TestMsgWithdrawDelegatorReward(t *testing.T) { height := f.app.LastBlockHeight() for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { res, err := f.app.RunMsg( tc.msg, @@ -469,7 +468,6 @@ func TestMsgSetWithdrawAddress(t *testing.T) { }, } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { tc.preRun() res, err := f.app.RunMsg( @@ -566,7 +564,6 @@ func TestMsgWithdrawValidatorCommission(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { res, err := f.app.RunMsg( tc.msg, @@ -600,7 +597,6 @@ func TestMsgWithdrawValidatorCommission(t *testing.T) { }, remainder.Commission) } }) - } } @@ -666,7 +662,6 @@ func TestMsgFundCommunityPool(t *testing.T) { }, } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { res, err := f.app.RunMsg( tc.msg, @@ -808,7 +803,6 @@ func TestMsgUpdateParams(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { res, err := f.app.RunMsg( tc.msg, @@ -891,7 +885,6 @@ func TestMsgCommunityPoolSpend(t *testing.T) { }, } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { res, err := f.app.RunMsg( tc.msg, @@ -992,7 +985,6 @@ func TestMsgDepositValidatorRewardsPool(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { res, err := f.app.RunMsg( tc.msg, diff --git a/tests/integration/genutil/genaccount_test.go b/tests/integration/genutil/genaccount_test.go index 739adda97d2b..1b1bd420e99e 100644 --- a/tests/integration/genutil/genaccount_test.go +++ b/tests/integration/genutil/genaccount_test.go @@ -72,7 +72,6 @@ func TestAddGenesisAccountCmd(t *testing.T) { } for _, tc := range tests { - tc := tc t.Run(tc.name, func(t *testing.T) { home := t.TempDir() logger := log.NewNopLogger() @@ -217,7 +216,6 @@ func TestBulkAddGenesisAccountCmd(t *testing.T) { } for _, tc := range tests { - tc := tc t.Run(tc.name, func(t *testing.T) { home := t.TempDir() logger := log.NewNopLogger() diff --git a/tests/integration/genutil/init_test.go b/tests/integration/genutil/init_test.go index 12fd1ccd0292..b49dbc6a7458 100644 --- a/tests/integration/genutil/init_test.go +++ b/tests/integration/genutil/init_test.go @@ -61,7 +61,6 @@ func TestInitCmd(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { home := t.TempDir() logger := log.NewNopLogger() diff --git a/tests/integration/staking/keeper/msg_server_test.go b/tests/integration/staking/keeper/msg_server_test.go index f5e4accc0073..7eb00bb97a97 100644 --- a/tests/integration/staking/keeper/msg_server_test.go +++ b/tests/integration/staking/keeper/msg_server_test.go @@ -163,8 +163,6 @@ func TestCancelUnbondingDelegation(t *testing.T) { } for _, tc := range testCases { - tc := tc - t.Run(tc.name, func(t *testing.T) { _, err := msgServer.CancelUnbondingDelegation(ctx, &tc.req) if tc.exceptErr { diff --git a/testutil/sims/simulation_helpers_test.go b/testutil/sims/simulation_helpers_test.go index 034b7e4346fd..a982c7ffafd4 100644 --- a/testutil/sims/simulation_helpers_test.go +++ b/testutil/sims/simulation_helpers_test.go @@ -51,7 +51,6 @@ func TestGetSimulationLog(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.store, func(t *testing.T) { require.Equal(t, tt.expectedLog, GetSimulationLog(tt.store, decoders, tt.kvPairs, tt.kvPairs), tt.store) }) diff --git a/tools/confix/migrations.go b/tools/confix/migrations.go index 437c628d7b25..86bf1affee24 100644 --- a/tools/confix/migrations.go +++ b/tools/confix/migrations.go @@ -74,7 +74,6 @@ func PlanBuilder(from *tomledit.Document, to, planType string, loadFn loadDestCo diffs := DiffKeys(from, target) for _, diff := range diffs { - diff := diff kv := diff.KV var step transform.Step diff --git a/tools/cosmovisor/args_test.go b/tools/cosmovisor/args_test.go index 74b75841ec5d..f121a3989d9f 100644 --- a/tools/cosmovisor/args_test.go +++ b/tools/cosmovisor/args_test.go @@ -765,8 +765,6 @@ func (s *argsTestSuite) TestGetConfigFromEnv() { } for _, tc := range tests { - tc := tc - s.T().Run(tc.name, func(t *testing.T) { s.setEnv(t, &tc.envVals) cfg, err := GetConfigFromEnv(false) diff --git a/tools/cosmovisor/cmd/cosmovisor/init_test.go b/tools/cosmovisor/cmd/cosmovisor/init_test.go index cea1349e3b39..97a082db729b 100644 --- a/tools/cosmovisor/cmd/cosmovisor/init_test.go +++ b/tools/cosmovisor/cmd/cosmovisor/init_test.go @@ -355,8 +355,6 @@ func (s *InitTestSuite) TestInitializeCosmovisorNegativeValidation() { } for _, tc := range tests { - tc := tc - s.T().Run(tc.name, func(t *testing.T) { s.setEnv(t, &tc.env) buffer, logger := s.NewCapturingLogger() diff --git a/types/address_test.go b/types/address_test.go index 04edc6d6075f..014a48b7386e 100644 --- a/types/address_test.go +++ b/types/address_test.go @@ -422,7 +422,6 @@ func (s *addressTestSuite) TestBech32ifyAddressBytes() { {"20-byte address", args{"prefixb", addr20byte}, "prefixb1qqqsyqcyq5rqwzqfpg9scrgwpugpzysnrujsuw", false}, } for _, tt := range tests { - tt := tt s.T().Run(tt.name, func(t *testing.T) { got, err := types.Bech32ifyAddressBytes(tt.args.prefix, tt.args.bs) if (err != nil) != tt.wantErr { @@ -453,7 +452,6 @@ func (s *addressTestSuite) TestMustBech32ifyAddressBytes() { {"20-byte address", args{"prefixb", addr20byte}, "prefixb1qqqsyqcyq5rqwzqfpg9scrgwpugpzysnrujsuw", false}, } for _, tt := range tests { - tt := tt s.T().Run(tt.name, func(t *testing.T) { if tt.wantPanic { require.Panics(t, func() { types.MustBech32ifyAddressBytes(tt.args.prefix, tt.args.bs) }) diff --git a/types/coin.go b/types/coin.go index 702d8591ddb0..19e002ff0f41 100644 --- a/types/coin.go +++ b/types/coin.go @@ -432,7 +432,6 @@ func (coins Coins) SafeMulInt(x math.Int) (Coins, bool) { res := make(Coins, len(coins)) for i, coin := range coins { - coin := coin res[i] = NewCoin(coin.Denom, coin.Amount.Mul(x)) } @@ -466,7 +465,6 @@ func (coins Coins) SafeQuoInt(x math.Int) (Coins, bool) { var res Coins for _, coin := range coins { - coin := coin res = append(res, NewCoin(coin.Denom, coin.Amount.Quo(x))) } diff --git a/types/coin_test.go b/types/coin_test.go index 5e7389e994ed..0c746ffb6206 100644 --- a/types/coin_test.go +++ b/types/coin_test.go @@ -178,7 +178,6 @@ func (s *coinTestSuite) TestAddCoin() { } for tcIndex, tc := range cases { - tc := tc if tc.shouldPanic { s.Require().Panics(func() { tc.inputOne.Add(tc.inputTwo) }) } else { @@ -218,7 +217,6 @@ func (s *coinTestSuite) TestSubCoin() { } for tcIndex, tc := range cases { - tc := tc if tc.shouldPanic { s.Require().Panics(func() { tc.inputOne.Sub(tc.inputTwo) }) } else { @@ -274,7 +272,6 @@ func (s *coinTestSuite) TestMulIntCoins() { assert := s.Assert() for i, tc := range testCases { - tc := tc if tc.shouldPanic { assert.Panics(func() { tc.input.MulInt(tc.multiplier) }) } else { @@ -301,7 +298,6 @@ func (s *coinTestSuite) TestQuoIntCoins() { assert := s.Assert() for i, tc := range testCases { - tc := tc if tc.shouldPanic { assert.Panics(func() { tc.input.QuoInt(tc.divisor) }) } else { @@ -326,7 +322,6 @@ func (s *coinTestSuite) TestIsGTCoin() { } for tcIndex, tc := range cases { - tc := tc if tc.panics { s.Require().Panics(func() { tc.inputOne.IsGT(tc.inputTwo) }) } else { @@ -350,7 +345,6 @@ func (s *coinTestSuite) TestIsGTECoin() { } for tcIndex, tc := range cases { - tc := tc if tc.panics { s.Require().Panics(func() { tc.inputOne.IsGTE(tc.inputTwo) }) } else { @@ -374,7 +368,6 @@ func (s *coinTestSuite) TestIsLTECoin() { } for tcIndex, tc := range cases { - tc := tc if tc.panics { s.Require().Panics(func() { tc.inputOne.IsLTE(tc.inputTwo) }) } else { @@ -400,7 +393,6 @@ func (s *coinTestSuite) TestIsLTCoin() { } for tcIndex, tc := range cases { - tc := tc if tc.panics { s.Require().Panics(func() { tc.inputOne.IsLT(tc.inputTwo) }) } else { @@ -683,7 +675,6 @@ func (s *coinTestSuite) TestSubCoins() { assert := s.Assert() for i, tc := range testCases { - tc := tc if tc.shouldPanic { assert.Panics(func() { tc.inputOne.Sub(tc.inputTwo...) }) } else { @@ -708,7 +699,7 @@ func (s *coinTestSuite) TestSafeSubCoin() { } for _, tc := range cases { - tc := tc + res, err := tc.inputOne.SafeSub(tc.inputTwo) if err != nil { s.Require().Contains(err.Error(), tc.expErrMsg) @@ -1373,7 +1364,7 @@ func (s *coinTestSuite) TestCoinValidate() { } for _, tc := range testCases { - tc := tc + t := s.T() t.Run(tc.name, func(t *testing.T) { err := tc.coin.Validate() diff --git a/types/context_test.go b/types/context_test.go index 8975c048f01e..d4e738edd156 100644 --- a/types/context_test.go +++ b/types/context_test.go @@ -203,7 +203,6 @@ func (s *contextTestSuite) TestContextHeaderClone() { } for name, tc := range cases { - tc := tc s.T().Run(name, func(t *testing.T) { ctx := types.NewContext(nil, false, nil).WithBlockHeader(tc.h) s.Require().Equal(tc.h.Height, ctx.BlockHeight()) diff --git a/types/dec_coin_test.go b/types/dec_coin_test.go index e71626b4ec49..486f72711b32 100644 --- a/types/dec_coin_test.go +++ b/types/dec_coin_test.go @@ -211,7 +211,6 @@ func (s *decCoinTestSuite) TestIsValid() { } for _, tc := range tests { - tc := tc if tc.expectPass { s.Require().True(tc.coin.IsValid(), tc.msg) } else { @@ -246,7 +245,6 @@ func (s *decCoinTestSuite) TestSubDecCoin() { decCoin := sdk.NewDecCoin("mytoken", math.NewInt(10)) for _, tc := range tests { - tc := tc if tc.expectPass { equal := tc.coin.Sub(decCoin) s.Require().Equal(equal, decCoin, tc.msg) @@ -282,7 +280,6 @@ func (s *decCoinTestSuite) TestSubDecCoins() { decCoins := sdk.NewDecCoinsFromCoins(sdk.NewCoin("btc", math.NewInt(10)), sdk.NewCoin("eth", math.NewInt(15)), sdk.NewCoin("mytoken", math.NewInt(5))) for _, tc := range tests { - tc := tc if tc.expectPass { equal := tc.coins.Sub(decCoins) s.Require().Equal(equal, decCoins, tc.msg) @@ -527,7 +524,6 @@ func (s *decCoinTestSuite) TestDecCoinsQuoDecTruncate() { } for i, tc := range testCases { - tc := tc if tc.panics { s.Require().Panics(func() { tc.coins.QuoDecTruncate(tc.input) }) } else { @@ -564,7 +560,6 @@ func (s *decCoinTestSuite) TestNewDecCoinsWithIsValid() { } for _, tc := range tests { - tc := tc if tc.expectPass { s.Require().True(tc.coin.IsValid(), tc.msg) } else { @@ -591,7 +586,6 @@ func (s *decCoinTestSuite) TestNewDecCoinsWithZeroCoins() { } for _, tc := range tests { - tc := tc s.Require().Equal(sdk.NewDecCoinsFromCoins(tc.coins...).Len(), tc.expectLength) } } @@ -623,7 +617,6 @@ func (s *decCoinTestSuite) TestDecCoins_AddDecCoinWithIsValid() { } for _, tc := range tests { - tc := tc if tc.expectPass { s.Require().True(tc.coin.IsValid(), tc.msg) } else { @@ -679,7 +672,6 @@ func (s *decCoinTestSuite) TestDecCoins_GetDenomByIndex() { } for i, tc := range testCases { - tc := tc s.T().Run(tc.name, func(t *testing.T) { if tc.expectedErr { s.Require().Panics(func() { tc.input.GetDenomByIndex(tc.index) }, "Test should have panicked") @@ -721,7 +713,6 @@ func (s *decCoinTestSuite) TestDecCoins_IsAllPositive() { } for i, tc := range testCases { - tc := tc s.T().Run(tc.name, func(t *testing.T) { if tc.expectedResult { s.Require().True(tc.input.IsAllPositive(), "Test case #%d: %s", i, tc.name) @@ -791,7 +782,6 @@ func (s *decCoinTestSuite) TestDecCoin_IsGTE() { } for i, tc := range testCases { - tc := tc s.T().Run(tc.name, func(t *testing.T) { if tc.expectedPanic { s.Require().Panics(func() { tc.coin.IsGTE(tc.otherCoin) }, "Test case #%d: %s", i, tc.name) @@ -835,7 +825,6 @@ func (s *decCoinTestSuite) TestDecCoins_IsZero() { } for i, tc := range testCases { - tc := tc s.T().Run(tc.name, func(t *testing.T) { if tc.expectedResult { s.Require().True(tc.coins.IsZero(), "Test case #%d: %s", i, tc.name) @@ -890,7 +879,6 @@ func (s *decCoinTestSuite) TestDecCoins_MulDec() { } for i, tc := range testCases { - tc := tc s.T().Run(tc.name, func(t *testing.T) { res := tc.coins.MulDec(tc.multiplier) s.Require().Equal(tc.expectedResult, res, "Test case #%d: %s", i, tc.name) @@ -939,7 +927,6 @@ func (s *decCoinTestSuite) TestDecCoins_MulDecTruncate() { } for i, tc := range testCases { - tc := tc s.T().Run(tc.name, func(t *testing.T) { if tc.expectedPanic { s.Require().Panics(func() { tc.coins.MulDecTruncate(tc.multiplier) }, "Test case #%d: %s", i, tc.name) @@ -992,7 +979,6 @@ func (s *decCoinTestSuite) TestDecCoins_QuoDec() { } for i, tc := range testCases { - tc := tc s.T().Run(tc.name, func(t *testing.T) { if tc.panics { s.Require().Panics(func() { tc.coins.QuoDec(tc.input) }, "Test case #%d: %s", i, tc.name) diff --git a/types/events_test.go b/types/events_test.go index 2b55952a9d6d..ae69f0e86531 100644 --- a/types/events_test.go +++ b/types/events_test.go @@ -268,7 +268,6 @@ func (s *eventsTestSuite) TestMarkEventsToIndex() { } for name, tc := range testCases { - tc := tc s.T().Run(name, func(_ *testing.T) { s.Require().Equal(tc.expected, sdk.MarkEventsToIndex(tc.events, tc.indexSet)) }) diff --git a/types/module/module.go b/types/module/module.go index 4d947fe2d7ac..7d865930b26b 100644 --- a/types/module/module.go +++ b/types/module/module.go @@ -594,7 +594,6 @@ func (m *Manager) assertNoForgottenModules(setOrderFnName string, moduleNames [] } var missing []string for m := range m.Modules { - m := m if pass != nil && pass(m) { continue } @@ -834,7 +833,6 @@ func (m *Manager) GetVersionMap() appmodule.VersionMap { if v, ok := v.(appmodule.HasConsensusVersion); ok { version = v.ConsensusVersion() } - name := name vermap[name] = version } diff --git a/types/query/collections_pagination_test.go b/types/query/collections_pagination_test.go index 0e76b28c7a00..25dc267a4481 100644 --- a/types/query/collections_pagination_test.go +++ b/types/query/collections_pagination_test.go @@ -140,7 +140,6 @@ func TestCollectionPagination(t *testing.T) { } for name, tc := range tcs { - tc := tc t.Run(name, func(t *testing.T) { gotResults, gotResponse, err := CollectionFilteredPaginate( ctx, diff --git a/types/simulation/account_test.go b/types/simulation/account_test.go index 276d16910e08..a7b806d8b76b 100644 --- a/types/simulation/account_test.go +++ b/types/simulation/account_test.go @@ -24,7 +24,6 @@ func TestRandomAccounts(t *testing.T) { {"100-accounts", 100, 100}, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { got := simulation.RandomAccounts(r, tt.n) require.Equal(t, tt.want, len(got)) @@ -66,8 +65,6 @@ func TestRandomFees(t *testing.T) { {"1 coin with 0 amount", sdk.Coins{sdk.NewInt64Coin("ccc", 0)}, true, true}, } for _, tt := range tests { - tt := tt - t.Run(tt.name, func(t *testing.T) { got, err := simulation.RandomFees(r, tt.spendableCoins) if (err != nil) != tt.wantErr { diff --git a/types/simulation/rand_util_test.go b/types/simulation/rand_util_test.go index d8704f69f01f..23270aa806c9 100644 --- a/types/simulation/rand_util_test.go +++ b/types/simulation/rand_util_test.go @@ -28,7 +28,6 @@ func TestRandSubsetCoins(t *testing.T) { {"too small amount", rand.New(rand.NewSource(99)), sdk.Coins{sdk.Coin{Denom: "aaa", Amount: math.NewInt(0)}}}, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { got := simulation.RandSubsetCoins(tt.r, tt.coins) gotStringRep := got.String() diff --git a/types/tx/direct_aux_test.go b/types/tx/direct_aux_test.go index f9e90b8e27e7..a1b655531eaa 100644 --- a/types/tx/direct_aux_test.go +++ b/types/tx/direct_aux_test.go @@ -33,7 +33,6 @@ func TestSignDocDirectAux(t *testing.T) { } for _, tc := range testcases { - tc := tc t.Run(tc.name, func(t *testing.T) { err := tc.sd.ValidateBasic() @@ -68,7 +67,6 @@ func TestAuxSignerData(t *testing.T) { } for _, tc := range testcases { - tc := tc t.Run(tc.name, func(t *testing.T) { err := tc.sd.ValidateBasic() diff --git a/types/utils_test.go b/types/utils_test.go index 22675a2c5990..4c74dfd438d3 100644 --- a/types/utils_test.go +++ b/types/utils_test.go @@ -33,7 +33,7 @@ func (s *utilsTestSuite) TestTimeFormatAndParse() { {"2011-01-10T23:10:05.758230235Z", "2011-01-10T23:10:05.758230235", true}, } for _, tc := range cases { - tc := tc + timeFromRFC, err := time.Parse(time.RFC3339Nano, tc.RFC3339NanoStr) s.Require().Nil(err) timeFromSDKFormat, err := time.Parse(sdk.SortableTimeFormat, tc.SDKSortableTimeStr) @@ -116,8 +116,6 @@ func (s *utilsTestSuite) TestParseTime() { } for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { tm, err := sdk.ParseTime(tc.input) if tc.expectErr { diff --git a/x/accounts/cli/cli_test.go b/x/accounts/cli/cli_test.go index aa5c2521852d..5e9c188d1d68 100644 --- a/x/accounts/cli/cli_test.go +++ b/x/accounts/cli/cli_test.go @@ -119,7 +119,6 @@ func (s *CLITestSuite) TestTxInitCmd() { } for _, tc := range testCases { - tc := tc s.Run(tc.name, func() { ctx := svrcmd.CreateExecuteContext(context.Background()) diff --git a/x/accounts/defaults/lockup/lockup_test.go b/x/accounts/defaults/lockup/lockup_test.go index 67f3cadfbdf4..31c3fda141a3 100644 --- a/x/accounts/defaults/lockup/lockup_test.go +++ b/x/accounts/defaults/lockup/lockup_test.go @@ -53,7 +53,6 @@ func TestInitLockupAccount(t *testing.T) { } for _, test := range testcases { - test := test _, err := baseLockup.Init(ctx, &test.msg) if test.expErr != nil { require.Equal(t, test.expErr, err) diff --git a/x/accounts/keeper.go b/x/accounts/keeper.go index fee356a7736f..64771e8da115 100644 --- a/x/accounts/keeper.go +++ b/x/accounts/keeper.go @@ -339,7 +339,7 @@ func (k Keeper) makeAccountContext(ctx context.Context, accountNumber uint64, ac // sendAnyMessages it a helper function that executes untyped codectypes.Any messages // The messages must all belong to a module. -// nolint: unused // TODO: remove nolint when we bring back bundler payments +//nolint: unused // TODO: remove nolint when we bring back bundler payments func (k Keeper) sendAnyMessages(ctx context.Context, sender []byte, anyMessages []*implementation.Any) ([]*implementation.Any, error) { anyResponses := make([]*implementation.Any, len(anyMessages)) for i := range anyMessages { diff --git a/x/auth/ante/basic_test.go b/x/auth/ante/basic_test.go index 389096d3d7c6..fd0dc29c1f0c 100644 --- a/x/auth/ante/basic_test.go +++ b/x/auth/ante/basic_test.go @@ -221,8 +221,6 @@ func TestTxHeightTimeoutDecorator(t *testing.T) { } for _, tc := range testCases { - tc := tc - t.Run(tc.name, func(t *testing.T) { suite.txBuilder = suite.clientCtx.TxConfig.NewTxBuilder() diff --git a/x/auth/client/tx_test.go b/x/auth/client/tx_test.go index 18ee2cd5a4d2..4c35286d7427 100644 --- a/x/auth/client/tx_test.go +++ b/x/auth/client/tx_test.go @@ -172,7 +172,6 @@ func TestBatchScanner_Scan(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { scanner, i := authclient.NewBatchScanner(clientCtx.TxConfig, strings.NewReader(tt.batch)), 0 for scanner.Scan() { diff --git a/x/auth/keeper/msg_server_test.go b/x/auth/keeper/msg_server_test.go index f65334ea5f1c..3e7a65cce451 100644 --- a/x/auth/keeper/msg_server_test.go +++ b/x/auth/keeper/msg_server_test.go @@ -120,7 +120,6 @@ func (s *KeeperTestSuite) TestUpdateParams() { } for _, tc := range testCases { - tc := tc s.Run(tc.name, func() { _, err := s.msgServer.UpdateParams(s.ctx, tc.req) if tc.expectErr { @@ -190,7 +189,6 @@ func (s *KeeperTestSuite) TestNonAtomicExec() { }).AnyTimes() for _, tc := range testCases { - tc := tc s.Run(tc.name, func() { _, err := s.msgServer.NonAtomicExec(s.ctx, tc.req) if tc.expectErr { diff --git a/x/auth/migrations/legacytx/stdtx_test.go b/x/auth/migrations/legacytx/stdtx_test.go index cdb28e978b2b..83909d45d6ec 100644 --- a/x/auth/migrations/legacytx/stdtx_test.go +++ b/x/auth/migrations/legacytx/stdtx_test.go @@ -90,7 +90,6 @@ func TestStdSignBytes(t *testing.T) { FileResolver: proto.HybridResolver, }) for i, tc := range tests { - tc := tc t.Run(tc.name, func(t *testing.T) { anyMsgs := make([]*anypb.Any, len(tc.args.msgs)) for j, msg := range tc.args.msgs { diff --git a/x/auth/tx/aux_test.go b/x/auth/tx/aux_test.go index f1e8dca0879b..9ac871bed501 100644 --- a/x/auth/tx/aux_test.go +++ b/x/auth/tx/aux_test.go @@ -100,7 +100,6 @@ func TestBuilderWithAux(t *testing.T) { {"happy case", func() {}, false}, } for _, tc := range testcases { - tc := tc t.Run(tc.name, func(t *testing.T) { txBuilder, txSig = makeTxBuilder(t) diff --git a/x/auth/tx/query.go b/x/auth/tx/query.go index c49ddfa25458..54af403316fb 100644 --- a/x/auth/tx/query.go +++ b/x/auth/tx/query.go @@ -114,8 +114,6 @@ func getBlocksForTxResults(clientCtx client.Context, resTxs []*coretypes.ResultT resBlocks := make(map[int64]*coretypes.ResultBlock) for _, resTx := range resTxs { - resTx := resTx - if _, ok := resBlocks[resTx.Height]; !ok { resBlock, err := node.Block(context.Background(), &resTx.Height) if err != nil { diff --git a/x/auth/types/account_test.go b/x/auth/types/account_test.go index b4fadfa391a7..f0cc88ae85fa 100644 --- a/x/auth/types/account_test.go +++ b/x/auth/types/account_test.go @@ -84,8 +84,6 @@ func TestGenesisAccountValidate(t *testing.T) { } for _, tt := range tests { - tt := tt - t.Run(tt.name, func(t *testing.T) { require.Equal(t, tt.expErr, tt.acc.Validate() != nil) }) @@ -151,7 +149,6 @@ func TestValidate(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { err := tt.acc.Validate() require.Equal(t, tt.expErr, err) diff --git a/x/auth/types/params_test.go b/x/auth/types/params_test.go index 587778e1f3d9..9c776c5509e2 100644 --- a/x/auth/types/params_test.go +++ b/x/auth/types/params_test.go @@ -37,7 +37,6 @@ func TestParams_Validate(t *testing.T) { types.DefaultSigVerifyCostED25519, types.DefaultSigVerifyCostSecp256k1), errors.New("invalid tx size cost per byte: 0")}, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { got := tt.params.Validate() if tt.wantErr == nil { diff --git a/x/auth/types/permissions_test.go b/x/auth/types/permissions_test.go index de5c25645769..78133007dac7 100644 --- a/x/auth/types/permissions_test.go +++ b/x/auth/types/permissions_test.go @@ -41,7 +41,6 @@ func TestValidatePermissions(t *testing.T) { } for i, tc := range cases { - i, tc := i, tc t.Run(tc.name, func(t *testing.T) { err := validatePermissions(tc.permissions...) if tc.expectPass { diff --git a/x/auth/vesting/types/vesting_account_test.go b/x/auth/vesting/types/vesting_account_test.go index 54330978d127..2e8270dd28ea 100644 --- a/x/auth/vesting/types/vesting_account_test.go +++ b/x/auth/vesting/types/vesting_account_test.go @@ -917,8 +917,6 @@ func TestGenesisAccountValidate(t *testing.T) { } for _, tt := range tests { - tt := tt - t.Run(tt.name, func(t *testing.T) { require.Equal(t, tt.expErr, tt.acc.Validate() != nil) }) diff --git a/x/authz/authorization_grant_test.go b/x/authz/authorization_grant_test.go index 76d50f6c2dfc..7b048d3f2413 100644 --- a/x/authz/authorization_grant_test.go +++ b/x/authz/authorization_grant_test.go @@ -35,7 +35,6 @@ func TestNewGrant(t *testing.T) { } for _, tc := range tcs { - tc := tc t.Run(tc.title, func(t *testing.T) { _, err := NewGrant(tc.blockTime, tc.a, tc.expire) expecError(require.New(t), tc.err, err) @@ -59,7 +58,6 @@ func TestValidateBasic(t *testing.T) { } for _, tc := range tcs { - tc := tc t.Run(tc.title, func(t *testing.T) { grant := Grant{ Authorization: tc.authorization, diff --git a/x/authz/keeper/grpc_query_test.go b/x/authz/keeper/grpc_query_test.go index 6cb51dbae0f7..b8d5042a96c8 100644 --- a/x/authz/keeper/grpc_query_test.go +++ b/x/authz/keeper/grpc_query_test.go @@ -192,7 +192,6 @@ func (suite *TestSuite) TestGRPCQueryGranterGrants() { } for _, tc := range testCases { - tc := tc suite.Run(fmt.Sprintf("Case %s", tc.msg), func() { tc.preRun() result, err := queryClient.GranterGrants(gocontext.Background(), &tc.request) @@ -275,8 +274,6 @@ func (suite *TestSuite) TestGRPCQueryGranteeGrants() { } for _, tc := range testCases { - tc := tc - suite.Run(fmt.Sprintf("Case %s", tc.msg), func() { tc.preRun() result, err := queryClient.GranteeGrants(gocontext.Background(), &tc.request) diff --git a/x/authz/simulation/decoder_test.go b/x/authz/simulation/decoder_test.go index ff14fd76e316..94f87b729cf4 100644 --- a/x/authz/simulation/decoder_test.go +++ b/x/authz/simulation/decoder_test.go @@ -48,7 +48,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.expectErr { require.Panics(t, func() { dec(kvPairs.Pairs[i], kvPairs.Pairs[i]) }, tt.name) diff --git a/x/bank/client/cli/tx_test.go b/x/bank/client/cli/tx_test.go index 963fa918a29e..8f18458f79de 100644 --- a/x/bank/client/cli/tx_test.go +++ b/x/bank/client/cli/tx_test.go @@ -148,7 +148,6 @@ func (s *CLITestSuite) TestMultiSendTxCmd() { } for _, tc := range testCases { - tc := tc s.Run(tc.name, func() { ctx := svrcmd.CreateExecuteContext(context.Background()) diff --git a/x/bank/keeper/genesis_test.go b/x/bank/keeper/genesis_test.go index cd08a1178dcb..42f6221092cf 100644 --- a/x/bank/keeper/genesis_test.go +++ b/x/bank/keeper/genesis_test.go @@ -109,7 +109,6 @@ func (suite *KeeperTestSuite) TestTotalSupply() { } for _, tc := range testcases { - tc := tc suite.Run(tc.name, func() { if tc.expErrMsg != "" { suite.Require().ErrorContains(suite.bankKeeper.InitGenesis(suite.ctx, tc.genesis), tc.expErrMsg) diff --git a/x/bank/keeper/grpc_query_test.go b/x/bank/keeper/grpc_query_test.go index c563e4b60f66..6de9321d404c 100644 --- a/x/bank/keeper/grpc_query_test.go +++ b/x/bank/keeper/grpc_query_test.go @@ -83,8 +83,6 @@ func (suite *KeeperTestSuite) TestQueryBalance() { } for _, tc := range testCases { - tc := tc - suite.Run(tc.name, func() { res, err := queryClient.Balance(gocontext.Background(), tc.req) if tc.expectErrMsg == "" { diff --git a/x/bank/keeper/msg_server_test.go b/x/bank/keeper/msg_server_test.go index ecc09f79ba78..c02f6943b90a 100644 --- a/x/bank/keeper/msg_server_test.go +++ b/x/bank/keeper/msg_server_test.go @@ -52,7 +52,6 @@ func (suite *KeeperTestSuite) TestMsgUpdateParams() { } for _, tc := range testCases { - tc := tc suite.Run(tc.name, func() { _, err := suite.msgServer.UpdateParams(suite.ctx, tc.input) @@ -145,7 +144,6 @@ func (suite *KeeperTestSuite) TestMsgSend() { } for _, tc := range testCases { - tc := tc suite.Run(tc.name, func() { suite.mockMintCoins(minterAcc) err := suite.bankKeeper.MintCoins(suite.ctx, minterAcc.Name, origCoins) @@ -252,7 +250,6 @@ func (suite *KeeperTestSuite) TestMsgMultiSend() { } for _, tc := range testCases { - tc := tc suite.Run(tc.name, func() { suite.mockMintCoins(minterAcc) err := suite.bankKeeper.MintCoins(suite.ctx, minterAcc.Name, origCoins) @@ -422,7 +419,6 @@ func (suite *KeeperTestSuite) TestMsgBurn() { } for _, tc := range testCases { - tc := tc suite.Run(tc.name, func() { suite.mockMintCoins(multiPermAcc) err := suite.bankKeeper.MintCoins(suite.ctx, multiPermAcc.Name, sdk.Coins{}.Add(origCoins)) diff --git a/x/bank/simulation/genesis_test.go b/x/bank/simulation/genesis_test.go index f5e93943d739..8fea56ada6db 100644 --- a/x/bank/simulation/genesis_test.go +++ b/x/bank/simulation/genesis_test.go @@ -83,8 +83,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/bank/types/balance_test.go b/x/bank/types/balance_test.go index c208f88c218c..85ed43d035c2 100644 --- a/x/bank/types/balance_test.go +++ b/x/bank/types/balance_test.go @@ -105,7 +105,6 @@ func TestBalanceValidate(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { err := tc.balance.Validate() @@ -129,7 +128,6 @@ func TestBalance_GetAddress(t *testing.T) { {"valid address", "cosmos1vy0ga0klndqy92ceqehfkvgmn4t94eteq4hmqv", false}, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { b := bank.Balance{Address: tt.Address} if !tt.err { diff --git a/x/bank/types/genesis_test.go b/x/bank/types/genesis_test.go index 93805ac84b57..f7412df117fa 100644 --- a/x/bank/types/genesis_test.go +++ b/x/bank/types/genesis_test.go @@ -146,7 +146,6 @@ func TestGenesisStateValidate(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(tt *testing.T) { err := tc.genesisState.Validate() diff --git a/x/bank/types/metadata_test.go b/x/bank/types/metadata_test.go index 3d8ba100005a..648e13195147 100644 --- a/x/bank/types/metadata_test.go +++ b/x/bank/types/metadata_test.go @@ -217,7 +217,6 @@ func TestMetadataValidate(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { err := tc.metadata.Validate() @@ -259,7 +258,6 @@ func TestMarshalJSONMetaData(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { bz, err := cdc.MarshalJSON(tc.input) require.NoError(t, err) diff --git a/x/distribution/client/common/common_test.go b/x/distribution/client/common/common_test.go index 2020e3b8f109..020047024ead 100644 --- a/x/distribution/client/common/common_test.go +++ b/x/distribution/client/common/common_test.go @@ -35,7 +35,6 @@ func TestQueryDelegationRewardsAddrValidation(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { _, _, err := QueryDelegationRewards(clientCtx, tt.args.delAddr, tt.args.valAddr) require.True(t, err != nil, tt.wantErr) diff --git a/x/distribution/keeper/grpc_query_test.go b/x/distribution/keeper/grpc_query_test.go index 84fa95def6cc..24271354930f 100644 --- a/x/distribution/keeper/grpc_query_test.go +++ b/x/distribution/keeper/grpc_query_test.go @@ -38,7 +38,6 @@ func TestQueryParams(t *testing.T) { } for _, tc := range cases { - tc := tc t.Run(tc.name, func(t *testing.T) { out, err := queryServer.Params(ctx, tc.req) if tc.errMsg == "" { @@ -94,7 +93,6 @@ func TestQueryValidatorDistributionInfo(t *testing.T) { } for _, tc := range cases { - tc := tc t.Run(tc.name, func(t *testing.T) { out, err := queryServer.ValidatorDistributionInfo(ctx, tc.req) if tc.errMsg == "" { @@ -173,7 +171,6 @@ func TestQueryCommunityPool(t *testing.T) { } for _, tc := range cases { - tc := tc t.Run(tc.name, func(t *testing.T) { out, err := queryServer.CommunityPool(ctx, tc.req) if tc.errMsg == "" { diff --git a/x/distribution/keeper/msg_server_test.go b/x/distribution/keeper/msg_server_test.go index 03f4e8c88565..a7acde70e34b 100644 --- a/x/distribution/keeper/msg_server_test.go +++ b/x/distribution/keeper/msg_server_test.go @@ -56,7 +56,6 @@ func TestMsgSetWithdrawAddress(t *testing.T) { } for _, tc := range cases { - tc := tc t.Run(tc.name, func(t *testing.T) { _, err := msgServer.SetWithdrawAddress(ctx, tc.msg) if tc.errMsg == "" { @@ -112,7 +111,6 @@ func TestMsgWithdrawDelegatorReward(t *testing.T) { } for _, tc := range cases { - tc := tc t.Run(tc.name, func(t *testing.T) { if tc.preRun != nil { tc.preRun() @@ -158,7 +156,6 @@ func TestMsgWithdrawValidatorCommission(t *testing.T) { } for _, tc := range cases { - tc := tc t.Run(tc.name, func(t *testing.T) { if tc.preRun != nil { tc.preRun() @@ -206,7 +203,6 @@ func TestMsgFundCommunityPool(t *testing.T) { } for _, tc := range cases { - tc := tc t.Run(tc.name, func(t *testing.T) { _, err := msgServer.FundCommunityPool(ctx, tc.msg) //nolint:staticcheck // Testing deprecated method if tc.errMsg == "" { @@ -267,7 +263,6 @@ func TestMsgUpdateParams(t *testing.T) { } for _, tc := range cases { - tc := tc t.Run(tc.name, func(t *testing.T) { _, err := msgServer.UpdateParams(ctx, tc.msg) if tc.errMsg == "" { @@ -340,7 +335,6 @@ func TestMsgCommunityPoolSpend(t *testing.T) { } for _, tc := range cases { - tc := tc t.Run(tc.name, func(t *testing.T) { _, err := msgServer.CommunityPoolSpend(ctx, tc.msg) //nolint:staticcheck // Testing deprecated method if tc.errMsg == "" { @@ -373,7 +367,6 @@ func TestMsgDepositValidatorRewardsPool(t *testing.T) { } for _, tc := range cases { - tc := tc t.Run(tc.name, func(t *testing.T) { _, err := msgServer.DepositValidatorRewardsPool(ctx, tc.msg) if tc.errMsg == "" { diff --git a/x/distribution/simulation/decoder_test.go b/x/distribution/simulation/decoder_test.go index c96f8444840f..52b4d1b4886f 100644 --- a/x/distribution/simulation/decoder_test.go +++ b/x/distribution/simulation/decoder_test.go @@ -51,7 +51,6 @@ func TestDecodeDistributionStore(t *testing.T) { {"other", ""}, } 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/distribution/simulation/genesis_test.go b/x/distribution/simulation/genesis_test.go index 6c74a5e2bffc..46ff6aedb755 100644 --- a/x/distribution/simulation/genesis_test.go +++ b/x/distribution/simulation/genesis_test.go @@ -77,8 +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/distribution/types/params_internal_test.go b/x/distribution/types/params_internal_test.go index 92cffd78460b..21bfd0f1bf16 100644 --- a/x/distribution/types/params_internal_test.go +++ b/x/distribution/types/params_internal_test.go @@ -24,7 +24,6 @@ func Test_validateAuxFuncs(t *testing.T) { {"two dec", args{math.LegacyNewDec(2)}, true}, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { require.Equal(t, tt.wantErr, validateCommunityTax(tt.args.i) != nil) }) diff --git a/x/evidence/keeper/msg_server_test.go b/x/evidence/keeper/msg_server_test.go index 86ac3447dcaa..fdc3b78d3cbf 100644 --- a/x/evidence/keeper/msg_server_test.go +++ b/x/evidence/keeper/msg_server_test.go @@ -70,7 +70,6 @@ func (s *KeeperTestSuite) TestSubmitEvidence() { } for _, tc := range testCases { - tc := tc s.Run(tc.name, func() { _, err := s.msgServer.SubmitEvidence(s.ctx, tc.req) if tc.expErr { diff --git a/x/evidence/types/evidence_test.go b/x/evidence/types/evidence_test.go index bfa20f82a98d..dd6b31056a70 100644 --- a/x/evidence/types/evidence_test.go +++ b/x/evidence/types/evidence_test.go @@ -70,7 +70,6 @@ func TestEquivocationValidateBasic(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { require.Equal(t, tc.expectErr, tc.e.ValidateBasic() != nil) }) diff --git a/x/feegrant/client/cli/tx_test.go b/x/feegrant/client/cli/tx_test.go index 0759d0752f71..2fcb4020185e 100644 --- a/x/feegrant/client/cli/tx_test.go +++ b/x/feegrant/client/cli/tx_test.go @@ -420,8 +420,6 @@ func (s *CLITestSuite) TestNewCmdFeeGrant() { } for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { cmd := cli.NewCmdFeeGrant() out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) @@ -624,8 +622,6 @@ func (s *CLITestSuite) TestFilteredFeeAllowance() { } for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { cmd := cli.NewCmdFeeGrant() out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) @@ -687,8 +683,6 @@ func (s *CLITestSuite) TestFilteredFeeAllowance() { } for _, tc := range cases { - tc := tc - s.Run(tc.name, func() { err := tc.malleate() s.Require().NoError(err) diff --git a/x/feegrant/grant_test.go b/x/feegrant/grant_test.go index a333a51e7756..4880b6eb3cf0 100644 --- a/x/feegrant/grant_test.go +++ b/x/feegrant/grant_test.go @@ -81,7 +81,6 @@ func TestGrant(t *testing.T) { } for name, tc := range cases { - tc := tc t.Run(name, func(t *testing.T) { granterStr, err := addressCodec.BytesToString(tc.granter) require.NoError(t, err) diff --git a/x/feegrant/keeper/genesis_test.go b/x/feegrant/keeper/genesis_test.go index 61cb5cd14a0c..dd2a1eb27bfc 100644 --- a/x/feegrant/keeper/genesis_test.go +++ b/x/feegrant/keeper/genesis_test.go @@ -144,7 +144,6 @@ func TestInitGenesis(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { f := initFixture(t) if !tc.invalidAddr { diff --git a/x/feegrant/simulation/decoder_test.go b/x/feegrant/simulation/decoder_test.go index f29fa98977ad..03d7d1a674c2 100644 --- a/x/feegrant/simulation/decoder_test.go +++ b/x/feegrant/simulation/decoder_test.go @@ -61,7 +61,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/genutil/client/cli/gentx_test.go b/x/genutil/client/cli/gentx_test.go index 221ce645da43..f3cd97a01844 100644 --- a/x/genutil/client/cli/gentx_test.go +++ b/x/genutil/client/cli/gentx_test.go @@ -109,7 +109,6 @@ func (s *CLITestSuite) TestGenTxCmd() { } for _, tc := range tests { - tc := tc dir := s.T().TempDir() genTxFile := filepath.Join(dir, "myTx") diff --git a/x/genutil/client/cli/migrate_test.go b/x/genutil/client/cli/migrate_test.go index 7e84b491b132..5cd7485d441c 100644 --- a/x/genutil/client/cli/migrate_test.go +++ b/x/genutil/client/cli/migrate_test.go @@ -50,7 +50,6 @@ func TestMigrateGenesis(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { genesisFile := testutil.WriteToNewTempFile(t, tc.genesis) jsonOutput, err := clitestutil.ExecTestCLICmd( diff --git a/x/genutil/client/cli/validate_genesis_test.go b/x/genutil/client/cli/validate_genesis_test.go index 0e4549099520..41c337f13732 100644 --- a/x/genutil/client/cli/validate_genesis_test.go +++ b/x/genutil/client/cli/validate_genesis_test.go @@ -85,8 +85,6 @@ func TestValidateGenesis(t *testing.T) { } for _, tc := range testCases { - tc := tc - t.Run(tc.name, func(t *testing.T) { genesisFile := testutil.WriteToNewTempFile(t, tc.genesis) _, err := clitestutil.ExecTestCLICmd(client.Context{}, cli.ValidateGenesisCmd(tc.genMM), []string{genesisFile.Name()}) diff --git a/x/genutil/utils_test.go b/x/genutil/utils_test.go index af2963df41fd..8304c290e647 100644 --- a/x/genutil/utils_test.go +++ b/x/genutil/utils_test.go @@ -51,7 +51,6 @@ func TestInitializeNodeValidatorFilesFromMnemonic(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { _, _, err := InitializeNodeValidatorFilesFromMnemonic(cfg, tt.mnemonic, "ed25519") diff --git a/x/gov/client/cli/prompt_test.go b/x/gov/client/cli/prompt_test.go index 89110536d7e1..359c9dea5b53 100644 --- a/x/gov/client/cli/prompt_test.go +++ b/x/gov/client/cli/prompt_test.go @@ -72,7 +72,6 @@ func TestPromptParseInteger(t *testing.T) { } for _, tc := range values { - tc := tc t.Run(tc.in, func(t *testing.T) { origStdin := readline.Stdin defer func() { diff --git a/x/gov/client/cli/tx_test.go b/x/gov/client/cli/tx_test.go index f0933d9ebedd..9bb1eddc19d5 100644 --- a/x/gov/client/cli/tx_test.go +++ b/x/gov/client/cli/tx_test.go @@ -160,8 +160,6 @@ func (s *CLITestSuite) TestNewCmdSubmitProposal() { } for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { cmd := cli.NewCmdSubmitProposal() @@ -256,8 +254,6 @@ func (s *CLITestSuite) TestNewCmdSubmitLegacyProposal() { } for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { cmd := cli.NewCmdSubmitLegacyProposal() @@ -360,7 +356,6 @@ func (s *CLITestSuite) TestNewCmdWeightedVote() { } for _, tc := range testCases { - tc := tc s.Run(tc.name, func() { cmd := cli.NewCmdWeightedVote() out, err := clitestutil.ExecTestCLICmd(s.clientCtx, cmd, tc.args) diff --git a/x/gov/client/utils/query_test.go b/x/gov/client/utils/query_test.go index 1d1b4119915a..3f555f37d90c 100644 --- a/x/gov/client/utils/query_test.go +++ b/x/gov/client/utils/query_test.go @@ -193,8 +193,6 @@ func TestGetPaginatedVotes(t *testing.T) { }, }, } { - tc := tc - t.Run(tc.description, func(t *testing.T) { marshaled := make([][]byte, len(tc.msgs)) clientCtx := client.Context{}. @@ -298,8 +296,6 @@ func TestGetSingleVote(t *testing.T) { }, }, } { - tc := tc - t.Run(tc.description, func(t *testing.T) { marshaled := make([][]byte, len(tc.msgs)) clientCtx := client.Context{}. diff --git a/x/gov/keeper/grpc_query_test.go b/x/gov/keeper/grpc_query_test.go index 0d90df884de6..265726a7f75a 100644 --- a/x/gov/keeper/grpc_query_test.go +++ b/x/gov/keeper/grpc_query_test.go @@ -938,8 +938,6 @@ func (suite *KeeperTestSuite) TestGRPCQueryParams() { } for _, tc := range testCases { - tc := tc - suite.Run(fmt.Sprintf("Case %s", tc.msg), func() { params, err := queryClient.Params(gocontext.Background(), &tc.req) @@ -1008,7 +1006,6 @@ func (suite *KeeperTestSuite) TestGRPCQueryMessagedBasedParams() { } for _, tc := range testCases { - tc := tc suite.Run(fmt.Sprintf("Case %s", tc.msg), func() { params, err := queryClient.MessageBasedParams(suite.ctx, &tc.req) if tc.expErrMsg != "" { diff --git a/x/gov/keeper/msg_server_test.go b/x/gov/keeper/msg_server_test.go index a1460167f227..34d01824d97f 100644 --- a/x/gov/keeper/msg_server_test.go +++ b/x/gov/keeper/msg_server_test.go @@ -2008,7 +2008,6 @@ func (suite *KeeperTestSuite) TestMsgUpdateParams() { } for _, tc := range testCases { - tc := tc suite.Run(tc.name, func() { msg := tc.input() exec := func(updateParams *v1.MsgUpdateParams) error { @@ -2154,7 +2153,6 @@ func (suite *KeeperTestSuite) TestMsgUpdateMessageParams() { } for _, tc := range testCases { - tc := tc suite.Run(tc.name, func() { _, err := suite.msgSrvr.UpdateMessageParams(suite.ctx, tc.input) if tc.expErrMsg != "" { @@ -2308,7 +2306,6 @@ func (suite *KeeperTestSuite) TestMsgSudoExec() { } for _, tc := range testCases { - tc := tc suite.Run(tc.name, func() { _, err := suite.msgSrvr.SudoExec(suite.ctx, tc.input) if tc.expErrMsg != "" { diff --git a/x/gov/migrations/v3/convert_test.go b/x/gov/migrations/v3/convert_test.go index 3b44f9724552..ff93e5474873 100644 --- a/x/gov/migrations/v3/convert_test.go +++ b/x/gov/migrations/v3/convert_test.go @@ -49,7 +49,6 @@ func TestConvertToLegacyProposal(t *testing.T) { for name, tc := range testCases { t.Run(name, func(t *testing.T) { - tc := tc proposal.FinalTallyResult = &tc.tallyResult v1beta1Proposal, err := v3.ConvertToLegacyProposal(proposal) if tc.expErr { @@ -156,8 +155,6 @@ func TestConvertToLegacyTallyResult(t *testing.T) { }, } for name, tc := range testCases { - tc := tc - t.Run(name, func(t *testing.T) { _, err := v3.ConvertToLegacyTallyResult(&tc.tallyResult) if tc.expErr { diff --git a/x/gov/simulation/genesis_test.go b/x/gov/simulation/genesis_test.go index 215225085d3a..4f5e70312ff7 100644 --- a/x/gov/simulation/genesis_test.go +++ b/x/gov/simulation/genesis_test.go @@ -100,8 +100,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/gov/types/v1/genesis_test.go b/x/gov/types/v1/genesis_test.go index 7040446b06b7..fc26ecd9e2fc 100644 --- a/x/gov/types/v1/genesis_test.go +++ b/x/gov/types/v1/genesis_test.go @@ -175,7 +175,6 @@ func TestValidateGenesis(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { err := v1.ValidateGenesis(codec, tc.genesisState()) if tc.expErrMsg != "" { diff --git a/x/group/client/cli/tx_test.go b/x/group/client/cli/tx_test.go index 3707e0f310d1..2ad9ad76479c 100644 --- a/x/group/client/cli/tx_test.go +++ b/x/group/client/cli/tx_test.go @@ -220,8 +220,6 @@ func (s *CLITestSuite) TestTxCreateGroup() { } for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { ctx := svrcmd.CreateExecuteContext(context.Background()) cmd.SetContext(ctx) @@ -336,8 +334,6 @@ func (s *CLITestSuite) TestTxUpdateGroupMembers() { } for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { ctx := svrcmd.CreateExecuteContext(context.Background()) @@ -460,8 +456,6 @@ func (s *CLITestSuite) TestTxCreateGroupWithPolicy() { }, } for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { ctx := svrcmd.CreateExecuteContext(context.Background()) @@ -597,8 +591,6 @@ func (s *CLITestSuite) TestTxCreateGroupPolicy() { } for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { ctx := svrcmd.CreateExecuteContext(context.Background()) @@ -704,8 +696,6 @@ func (s *CLITestSuite) TestTxUpdateGroupPolicyDecisionPolicy() { } for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { ctx := svrcmd.CreateExecuteContext(context.Background()) @@ -808,8 +798,6 @@ func (s *CLITestSuite) TestTxSubmitProposal() { } for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { ctx := svrcmd.CreateExecuteContext(context.Background()) diff --git a/x/group/genesis_test.go b/x/group/genesis_test.go index 1671908fd63f..59753996d0bc 100644 --- a/x/group/genesis_test.go +++ b/x/group/genesis_test.go @@ -743,7 +743,6 @@ func TestGenesisStateValidate(t *testing.T) { }, } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { err := tc.genesisState.Validate() if tc.expErr { diff --git a/x/group/internal/orm/auto_uint64_test.go b/x/group/internal/orm/auto_uint64_test.go index c6e4870701c1..b61202f504e5 100644 --- a/x/group/internal/orm/auto_uint64_test.go +++ b/x/group/internal/orm/auto_uint64_test.go @@ -48,7 +48,6 @@ func TestAutoUInt64PrefixScan(t *testing.T) { Metadata: metadata, } for _, g := range []testdata.TableModel{t1, t2, t3} { - g := g _, err := tb.Create(store, &g) require.NoError(t, err) } diff --git a/x/group/internal/orm/index_test.go b/x/group/internal/orm/index_test.go index 24ae13b6d480..7e86fc4acba3 100644 --- a/x/group/internal/orm/index_test.go +++ b/x/group/internal/orm/index_test.go @@ -125,7 +125,6 @@ func TestIndexPrefixScan(t *testing.T) { Metadata: []byte("metadata-b"), } for _, g := range []testdata.TableModel{g1, g2, g3} { - g := g _, err := tb.Create(store, &g) require.NoError(t, err) } diff --git a/x/group/internal/orm/iterator.go b/x/group/internal/orm/iterator.go index c2612a4954fc..709a7f7a823c 100644 --- a/x/group/internal/orm/iterator.go +++ b/x/group/internal/orm/iterator.go @@ -298,7 +298,7 @@ func assertDest(dest ModelSlicePtr, destRef, tmpSlice *reflect.Value) (reflect.T protoMarshaler := reflect.TypeOf((*proto.Message)(nil)).Elem() if !elemType.Implements(protoMarshaler) && - !reflect.PtrTo(elemType).Implements(protoMarshaler) { + !reflect.PointerTo(elemType).Implements(protoMarshaler) { return nil, errorsmod.Wrapf(grouperrors.ErrORMInvalidArgument, "unsupported type :%s", elemType) } diff --git a/x/group/internal/orm/iterator_test.go b/x/group/internal/orm/iterator_test.go index bc3c29a57ea7..8ff344d61ea5 100644 --- a/x/group/internal/orm/iterator_test.go +++ b/x/group/internal/orm/iterator_test.go @@ -244,7 +244,6 @@ func TestPaginate(t *testing.T) { } for _, g := range []testdata.TableModel{t1, t2, t3, t4, t5} { - g := g _, err := tb.Create(store, &g) require.NoError(t, err) } diff --git a/x/group/internal/orm/orm_scenario_test.go b/x/group/internal/orm/orm_scenario_test.go index c666f4908116..f32037ccb7f0 100644 --- a/x/group/internal/orm/orm_scenario_test.go +++ b/x/group/internal/orm/orm_scenario_test.go @@ -281,7 +281,6 @@ func TestGasCostsPrimaryKeyTable(t *testing.T) { for i, m := range tms { testCtx.Ctx = testCtx.Ctx.WithGasMeter(storetypes.NewInfiniteGasMeter()) - m := m err = k.primaryKeyTable.Delete(store, &m) require.NoError(t, err) diff --git a/x/group/internal/orm/primary_key_test.go b/x/group/internal/orm/primary_key_test.go index 7d0a77e36578..08cf2b71c560 100644 --- a/x/group/internal/orm/primary_key_test.go +++ b/x/group/internal/orm/primary_key_test.go @@ -48,7 +48,6 @@ func TestPrimaryKeyTablePrefixScan(t *testing.T) { Metadata: metadata, } for _, g := range []testdata.TableModel{t1, t2, t3} { - g := g require.NoError(t, tb.Create(store, &g)) } diff --git a/x/group/keeper/abci_test.go b/x/group/keeper/abci_test.go index 0db99839d51c..9cd40f8edb3d 100644 --- a/x/group/keeper/abci_test.go +++ b/x/group/keeper/abci_test.go @@ -332,7 +332,6 @@ func (s *IntegrationTestSuite) TestEndBlockerPruning() { }, } for msg, spec := range specs { - spec := spec s.Run(msg, func() { proposalID := spec.setupProposal(ctx) @@ -544,7 +543,6 @@ func (s *IntegrationTestSuite) TestEndBlockerTallying() { for msg, spec := range specs { s.Run(msg, func() { - spec := spec pID := spec.preRun(ctx) err := s.groupKeeper.EndBlocker(spec.newCtx) diff --git a/x/group/keeper/grpc_query_test.go b/x/group/keeper/grpc_query_test.go index 84f7a7c31a34..8f90ebd6e917 100644 --- a/x/group/keeper/grpc_query_test.go +++ b/x/group/keeper/grpc_query_test.go @@ -129,8 +129,6 @@ func TestQueryGroupInfo(t *testing.T) { } for _, tc := range testCases { - tc := tc - t.Run(tc.name, func(t *testing.T) { _, err := fixture.queryClient.GroupInfo(fixture.ctx, &tc.req) if tc.expErrMsg != "" { @@ -169,7 +167,6 @@ func TestQueryGroupPolicyInfo(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { _, err := fixture.queryClient.GroupPolicyInfo(fixture.ctx, &tc.req) if tc.expErrMsg != "" { @@ -210,7 +207,6 @@ func TestQueryGroupMembers(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { resp, err := fixture.queryClient.GroupMembers(fixture.ctx, &tc.req) if tc.expErrMsg != "" { @@ -256,7 +252,6 @@ func TestQueryGroupsByAdmin(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { resp, err := fixture.queryClient.GroupsByAdmin(fixture.ctx, &tc.req) if tc.expErrMsg != "" { @@ -297,7 +292,6 @@ func TestQueryGroupPoliciesByGroup(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { resp, err := fixture.keeper.GroupPoliciesByGroup(fixture.ctx, &tc.req) if tc.expErrMsg != "" { @@ -343,7 +337,6 @@ func TestQueryGroupPoliciesByAdmin(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { resp, err := fixture.keeper.GroupPoliciesByAdmin(fixture.ctx, &tc.req) if tc.expErrMsg != "" { diff --git a/x/group/keeper/keeper.go b/x/group/keeper/keeper.go index aab09f065def..5336704535dd 100644 --- a/x/group/keeper/keeper.go +++ b/x/group/keeper/keeper.go @@ -379,8 +379,6 @@ func (k Keeper) PruneProposals(ctx context.Context) error { return nil } for _, proposal := range proposals { - proposal := proposal - err := k.pruneProposal(ctx, proposal.Id) if err != nil { return err diff --git a/x/group/keeper/keeper_test.go b/x/group/keeper/keeper_test.go index f761573b5a63..449fe039407f 100644 --- a/x/group/keeper/keeper_test.go +++ b/x/group/keeper/keeper_test.go @@ -273,7 +273,6 @@ func (s *TestSuite) TestProposalsByVPEnd() { } for msg, spec := range specs { - spec := spec s.Run(msg, func() { pID := spec.preRun(s.sdkCtx) diff --git a/x/group/keeper/msg_server_test.go b/x/group/keeper/msg_server_test.go index f345686327d1..d03f8721d563 100644 --- a/x/group/keeper/msg_server_test.go +++ b/x/group/keeper/msg_server_test.go @@ -169,7 +169,6 @@ func (s *TestSuite) TestCreateGroup() { var seq uint32 = 1 for msg, spec := range specs { - spec := spec s.Run(msg, func() { blockTime := sdk.UnwrapSDKContext(s.ctx).HeaderInfo().Time res, err := s.groupKeeper.CreateGroup(s.ctx, spec.req) @@ -520,7 +519,6 @@ func (s *TestSuite) TestUpdateGroupMembers() { }, } for msg, spec := range specs { - spec := spec s.Run(msg, func() { sdkCtx, _ := s.sdkCtx.CacheContext() _, err := s.groupKeeper.UpdateGroupMembers(sdkCtx, spec.req) @@ -657,7 +655,6 @@ func (s *TestSuite) TestUpdateGroupAdmin() { }, } for msg, spec := range specs { - spec := spec s.Run(msg, func() { _, err := s.groupKeeper.UpdateGroupAdmin(s.ctx, spec.req) if spec.expErr { @@ -727,7 +724,6 @@ func (s *TestSuite) TestUpdateGroupMetadata() { }, } for msg, spec := range specs { - spec := spec s.Run(msg, func() { sdkCtx, _ := s.sdkCtx.CacheContext() _, err := s.groupKeeper.UpdateGroupMetadata(sdkCtx, spec.req) @@ -897,7 +893,6 @@ func (s *TestSuite) TestCreateGroupWithPolicy() { } for msg, spec := range specs { - spec := spec s.Run(msg, func() { s.setNextAccount() err := spec.req.SetDecisionPolicy(spec.policy) @@ -1084,7 +1079,6 @@ func (s *TestSuite) TestCreateGroupPolicy() { }, } for msg, spec := range specs { - spec := spec s.Run(msg, func() { err := spec.req.SetDecisionPolicy(spec.policy) s.Require().NoError(err) @@ -1218,7 +1212,7 @@ func (s *TestSuite) TestUpdateGroupPolicyAdmin() { }, } for msg, spec := range specs { - spec := spec + err := spec.expGroupPolicy.SetDecisionPolicy(policy) s.Require().NoError(err) @@ -1369,7 +1363,7 @@ func (s *TestSuite) TestUpdateGroupPolicyDecisionPolicy() { }, } for msg, spec := range specs { - spec := spec + policyAddr := groupPolicyAddr err := spec.expGroupPolicy.SetDecisionPolicy(spec.policy) s.Require().NoError(err) @@ -1470,7 +1464,7 @@ func (s *TestSuite) TestUpdateGroupPolicyMetadata() { }, } for msg, spec := range specs { - spec := spec + err := spec.expGroupPolicy.SetDecisionPolicy(policy) s.Require().NoError(err) @@ -1877,7 +1871,6 @@ func (s *TestSuite) TestSubmitProposal() { }, } for msg, spec := range specs { - spec := spec s.Run(msg, func() { err := spec.req.SetMsgs(spec.msgs) s.Require().NoError(err) @@ -2002,7 +1995,7 @@ func (s *TestSuite) TestWithdrawProposal() { }, } for msg, spec := range specs { - spec := spec + s.Run(msg, func() { pID := spec.preRun(s.sdkCtx) @@ -2385,7 +2378,6 @@ func (s *TestSuite) TestVote() { }, } for msg, spec := range specs { - spec := spec s.Run(msg, func() { sdkCtx := s.sdkCtx if !spec.srcCtx.IsZero() { @@ -2738,7 +2730,6 @@ func (s *TestSuite) TestExecProposal() { }, } for msg, spec := range specs { - spec := spec s.Run(msg, func() { sdkCtx, _ := s.sdkCtx.CacheContext() proposalID := spec.setupProposal(sdkCtx) @@ -2782,7 +2773,6 @@ func (s *TestSuite) TestExecProposal() { } spec.postRun(sdkCtx) }) - } } @@ -2935,7 +2925,6 @@ func (s *TestSuite) TestExecPrunedProposalsAndVotes() { }, } for msg, spec := range specs { - spec := spec s.Run(msg, func() { sdkCtx, _ := s.sdkCtx.CacheContext() proposalID := spec.setupProposal(sdkCtx) @@ -3343,7 +3332,6 @@ func (s *TestSuite) TestExecProposalsWhenMemberLeavesOrIsUpdated() { }, } for msg, spec := range specs { - spec := spec s.Run(msg, func() { sdkCtx, _ := s.sdkCtx.CacheContext() diff --git a/x/group/keeper/tally_test.go b/x/group/keeper/tally_test.go index 80528675144a..0b8575fa1610 100644 --- a/x/group/keeper/tally_test.go +++ b/x/group/keeper/tally_test.go @@ -66,7 +66,6 @@ func (s *TestSuite) TestTally() { } for msg, spec := range specs { - spec := spec s.Run(msg, func() { sdkCtx, _ := s.sdkCtx.CacheContext() pID := spec.setupProposal(sdkCtx) diff --git a/x/group/simulation/decoder_test.go b/x/group/simulation/decoder_test.go index ee4a995907c9..2c6cd2d1d670 100644 --- a/x/group/simulation/decoder_test.go +++ b/x/group/simulation/decoder_test.go @@ -78,7 +78,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.expectErr { require.Panics(t, func() { dec(kvPairs.Pairs[i], kvPairs.Pairs[i]) }, tt.name) diff --git a/x/mint/keeper/msg_server_test.go b/x/mint/keeper/msg_server_test.go index 10423e26e2c6..602b4a2fbf36 100644 --- a/x/mint/keeper/msg_server_test.go +++ b/x/mint/keeper/msg_server_test.go @@ -61,7 +61,6 @@ func (s *KeeperTestSuite) TestUpdateParams() { } for _, tc := range testCases { - tc := tc s.Run(tc.name, func() { _, err := s.msgServer.UpdateParams(s.ctx, tc.request) if tc.expectErr { diff --git a/x/nft/simulation/decoder_test.go b/x/nft/simulation/decoder_test.go index 7498ee7e8f58..a9dfed8862ed 100644 --- a/x/nft/simulation/decoder_test.go +++ b/x/nft/simulation/decoder_test.go @@ -75,7 +75,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.expectErr { require.Panics(t, func() { dec(kvPairs.Pairs[i], kvPairs.Pairs[i]) }, tt.name) diff --git a/x/params/keeper/keeper_test.go b/x/params/keeper/keeper_test.go index d82db839dd35..25b7609fed08 100644 --- a/x/params/keeper/keeper_test.go +++ b/x/params/keeper/keeper_test.go @@ -88,13 +88,11 @@ func TestKeeper(t *testing.T) { // Set params for i, kv := range kvs { - kv := kv require.NotPanics(t, func() { space.Set(ctx, []byte(kv.key), kv.param) }, "space.Set panics, tc #%d", i) } // Test space.Get for i, kv := range kvs { - i, kv := i, kv var param int64 require.NotPanics(t, func() { space.Get(ctx, []byte(kv.key), ¶m) }, "space.Get panics, tc #%d", i) require.Equal(t, kv.param, param, "stored param not equal, tc #%d", i) @@ -121,20 +119,17 @@ func TestKeeper(t *testing.T) { // Test invalid space.Get for i, kv := range kvs { - kv := kv var param bool require.Panics(t, func() { space.Get(ctx, []byte(kv.key), ¶m) }, "invalid space.Get not panics, tc #%d", i) } // Test invalid space.Set for i, kv := range kvs { - kv := kv require.Panics(t, func() { space.Set(ctx, []byte(kv.key), true) }, "invalid space.Set not panics, tc #%d", i) } // Test GetSubspace for i, kv := range kvs { - i, kv := i, kv var gparam, param int64 gspace, ok := keeper.GetSubspace("test") require.True(t, ok, "cannot retrieve subspace, tc #%d", i) @@ -219,7 +214,6 @@ func TestSubspace(t *testing.T) { // Test space.Set, space.Modified for i, kv := range kvs { - i, kv := i, kv require.False(t, space.Modified(ctx, []byte(kv.key)), "space.Modified returns true before setting, tc #%d", i) require.NotPanics(t, func() { space.Set(ctx, []byte(kv.key), kv.param) }, "space.Set panics, tc #%d", i) require.True(t, space.Modified(ctx, []byte(kv.key)), "space.Modified returns false after setting, tc #%d", i) @@ -227,7 +221,6 @@ func TestSubspace(t *testing.T) { // Test space.Get, space.GetIfExists for i, kv := range kvs { - i, kv := i, kv require.NotPanics(t, func() { space.GetIfExists(ctx, []byte("invalid"), kv.ptr) }, "space.GetIfExists panics when no value exists, tc #%d", i) require.Equal(t, kv.zero, indirect(kv.ptr), "space.GetIfExists unmarshalls when no value exists, tc #%d", i) require.Panics(t, func() { space.Get(ctx, []byte("invalid"), kv.ptr) }, "invalid space.Get not panics when no value exists, tc #%d", i) diff --git a/x/params/types/subspace_test.go b/x/params/types/subspace_test.go index 947c86446bc8..651d868ec18f 100644 --- a/x/params/types/subspace_test.go +++ b/x/params/types/subspace_test.go @@ -236,7 +236,6 @@ func (suite *SubspaceTestSuite) TestSetParamSet() { } for _, tc := range testCases { - tc := tc suite.Run(tc.name, func() { suite.Require().Panics(func() { suite.ss.SetParamSet(suite.ctx, tc.ps) diff --git a/x/simulation/operation.go b/x/simulation/operation.go index e0cf06f3f173..6ba092713f94 100644 --- a/x/simulation/operation.go +++ b/x/simulation/operation.go @@ -82,7 +82,6 @@ func queueOperations(queuedOps OperationQueue, queuedTimeOps *[]simulation.Futur } for _, futureOp := range futureOps { - futureOp := futureOp if futureOp.BlockHeight != 0 { if val, ok := queuedOps[futureOp.BlockHeight]; ok { queuedOps[futureOp.BlockHeight] = append(val, futureOp.Op) diff --git a/x/slashing/keeper/msg_server_test.go b/x/slashing/keeper/msg_server_test.go index 39b04636328d..2554ac5fe2ab 100644 --- a/x/slashing/keeper/msg_server_test.go +++ b/x/slashing/keeper/msg_server_test.go @@ -135,7 +135,6 @@ func (s *KeeperTestSuite) TestUpdateParams() { } for _, tc := range testCases { - tc := tc s.Run(tc.name, func() { _, err := s.msgServer.UpdateParams(s.ctx, tc.request) if tc.expectErr { @@ -345,7 +344,6 @@ func (s *KeeperTestSuite) TestUnjail() { } for _, tc := range testCases { - tc := tc s.Run(tc.name, func() { req := tc.malleate() _, err := s.msgServer.Unjail(s.ctx, req) diff --git a/x/slashing/simulation/decoder_test.go b/x/slashing/simulation/decoder_test.go index 50d9887a491d..6a668a8ddfe7 100644 --- a/x/slashing/simulation/decoder_test.go +++ b/x/slashing/simulation/decoder_test.go @@ -50,7 +50,6 @@ func TestDecodeStore(t *testing.T) { {"other", "", true}, } for i, tt := range tests { - i, tt := i, tt t.Run(tt.name, func(t *testing.T) { if tt.panics { require.Panics(t, func() { dec(kvPairs.Pairs[i], kvPairs.Pairs[i]) }, tt.name) diff --git a/x/staking/client/cli/tx_test.go b/x/staking/client/cli/tx_test.go index 6a39cde2f711..c63bf53ee2b4 100644 --- a/x/staking/client/cli/tx_test.go +++ b/x/staking/client/cli/tx_test.go @@ -149,7 +149,6 @@ func (s *CLITestSuite) TestPrepareConfigForTxCreateValidator() { } for _, tc := range tests { - tc := tc s.Run(tc.name, func() { fs, _ := cli.CreateValidatorMsgFlagSet(ip) fs.String(flags.FlagName, "", "name of private key with which to sign the gentx") @@ -296,7 +295,6 @@ func (s *CLITestSuite) TestNewCreateValidatorCmd() { }, } for _, tc := range testCases { - tc := tc s.Run(tc.name, func() { out, err := clitestutil.ExecTestCLICmd(s.clientCtx, cmd, tc.args) if tc.expectErrMsg != "" { @@ -419,8 +417,6 @@ func (s *CLITestSuite) TestNewEditValidatorCmd() { } for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { out, err := clitestutil.ExecTestCLICmd(s.clientCtx, cmd, tc.args) if tc.expectErrMsg != "" { diff --git a/x/staking/genesis_test.go b/x/staking/genesis_test.go index ce7eba2ac28b..f7bf349d5a66 100644 --- a/x/staking/genesis_test.go +++ b/x/staking/genesis_test.go @@ -44,8 +44,6 @@ func TestValidateGenesis(t *testing.T) { } for _, tt := range tests { - tt := tt - t.Run(tt.name, func(t *testing.T) { genesisState := types.DefaultGenesisState() tt.mutate(genesisState) diff --git a/x/staking/keeper/grpc_query.go b/x/staking/keeper/grpc_query.go index 99030babfbeb..e55671f34c9e 100644 --- a/x/staking/keeper/grpc_query.go +++ b/x/staking/keeper/grpc_query.go @@ -411,7 +411,7 @@ func (k Querier) DelegatorUnbondingDelegations(ctx context.Context, req *types.Q } // HistoricalInfo queries the historical info for given height -func (k Querier) HistoricalInfo(ctx context.Context, req *types.QueryHistoricalInfoRequest) (*types.QueryHistoricalInfoResponse, error) { // nolint:staticcheck // SA1019: deprecated endpoint +func (k Querier) HistoricalInfo(ctx context.Context, req *types.QueryHistoricalInfoRequest) (*types.QueryHistoricalInfoResponse, error) { //nolint:staticcheck // SA1019: deprecated endpoint if req == nil { return nil, status.Error(codes.InvalidArgument, "empty request") } diff --git a/x/staking/keeper/msg_server_test.go b/x/staking/keeper/msg_server_test.go index f436b2ebda00..b5d92d62f535 100644 --- a/x/staking/keeper/msg_server_test.go +++ b/x/staking/keeper/msg_server_test.go @@ -314,7 +314,6 @@ func (s *KeeperTestSuite) TestMsgCreateValidator() { }, } for _, tc := range testCases { - tc := tc s.T().Run(tc.name, func(t *testing.T) { if tc.expPanic { require.PanicsWithValue(tc.expPanicMsg, func() { @@ -496,7 +495,6 @@ func (s *KeeperTestSuite) TestMsgEditValidator() { }, } for _, tc := range testCases { - tc := tc s.T().Run(tc.name, func(t *testing.T) { _, err := msgServer.EditValidator(tc.ctx, tc.input) if tc.expErr { @@ -614,7 +612,6 @@ func (s *KeeperTestSuite) TestMsgDelegate() { } for _, tc := range testCases { - tc := tc s.T().Run(tc.name, func(t *testing.T) { _, err := msgServer.Delegate(ctx, tc.input) if tc.expErr { @@ -782,7 +779,6 @@ func (s *KeeperTestSuite) TestMsgBeginRedelegate() { } for _, tc := range testCases { - tc := tc s.T().Run(tc.name, func(t *testing.T) { _, err := msgServer.BeginRedelegate(ctx, tc.input) if tc.expErr { @@ -906,7 +902,6 @@ func (s *KeeperTestSuite) TestMsgUndelegate() { } for _, tc := range testCases { - tc := tc s.T().Run(tc.name, func(t *testing.T) { _, err := msgServer.Undelegate(ctx, tc.input) if tc.expErr { @@ -1068,7 +1063,6 @@ func (s *KeeperTestSuite) TestMsgCancelUnbondingDelegation() { } for _, tc := range testCases { - tc := tc s.T().Run(tc.name, func(t *testing.T) { _, err := msgServer.CancelUnbondingDelegation(ctx, tc.input) if tc.expErr { @@ -1233,7 +1227,6 @@ func (s *KeeperTestSuite) TestMsgUpdateParams() { } for _, tc := range testCases { - tc := tc s.T().Run(tc.name, func(t *testing.T) { _, err := msgServer.UpdateParams(ctx, tc.input) if tc.expErrMsg != "" { diff --git a/x/staking/simulation/decoder_test.go b/x/staking/simulation/decoder_test.go index 897219b86cce..cfdf2adf19a1 100644 --- a/x/staking/simulation/decoder_test.go +++ b/x/staking/simulation/decoder_test.go @@ -46,7 +46,6 @@ func TestDecodeStore(t *testing.T) { {"other", ""}, } 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/staking/simulation/genesis_test.go b/x/staking/simulation/genesis_test.go index d6350a037b28..d07553c0c156 100644 --- a/x/staking/simulation/genesis_test.go +++ b/x/staking/simulation/genesis_test.go @@ -109,8 +109,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/staking/types/authz_test.go b/x/staking/types/authz_test.go index 1a8a66420dc0..c4ab9dc7bbd8 100644 --- a/x/staking/types/authz_test.go +++ b/x/staking/types/authz_test.go @@ -408,7 +408,6 @@ func TestAuthzAuthorizations(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.msg, func(t *testing.T) { delAuth, err := stakingtypes.NewStakeAuthorization(tc.allowed, tc.denied, tc.msgType, tc.limit, valAddressCodec) require.NoError(t, err) diff --git a/x/tx/decode/unknown_test.go b/x/tx/decode/unknown_test.go index dddabbb40267..7d901a5a29e2 100644 --- a/x/tx/decode/unknown_test.go +++ b/x/tx/decode/unknown_test.go @@ -233,7 +233,6 @@ func TestRejectUnknownFieldsRepeated(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { protoBlob, err := proto.Marshal(tt.in) if err != nil { @@ -294,7 +293,6 @@ func TestRejectUnknownFields_allowUnknownNonCriticals(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { blob, err := proto.Marshal(tt.in) if err != nil { @@ -491,7 +489,6 @@ func TestRejectUnknownFieldsNested(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { protoBlob, err := proto.Marshal(tt.in) if err != nil { @@ -627,7 +624,6 @@ func TestRejectUnknownFieldsFlat(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { blob, err := proto.Marshal(tt.in) if err != nil { diff --git a/x/tx/signing/textual/any_test.go b/x/tx/signing/textual/any_test.go index da64acf0df79..0bcce5988151 100644 --- a/x/tx/signing/textual/any_test.go +++ b/x/tx/signing/textual/any_test.go @@ -88,7 +88,6 @@ func TestDynamicpb(t *testing.T) { } for _, tc := range testcases { - tc := tc t.Run(tc.name, func(t *testing.T) { any, err := anyutil.New(tc.msg) require.NoError(t, err) diff --git a/x/tx/signing/textual/dec_test.go b/x/tx/signing/textual/dec_test.go index f8c7b3ebe2f4..152e2b71619e 100644 --- a/x/tx/signing/textual/dec_test.go +++ b/x/tx/signing/textual/dec_test.go @@ -27,7 +27,6 @@ func TestDecJSONTestcases(t *testing.T) { require.NoError(t, err) for _, tc := range testcases { - tc := tc t.Run(tc[0], func(t *testing.T) { r, err := textual.GetFieldValueRenderer(fieldDescriptorFromName("SDKDEC")) require.NoError(t, err) diff --git a/x/tx/signing/textual/handler_test.go b/x/tx/signing/textual/handler_test.go index 70c2ea124a9f..13e15b981845 100644 --- a/x/tx/signing/textual/handler_test.go +++ b/x/tx/signing/textual/handler_test.go @@ -32,7 +32,6 @@ func TestDispatcher(t *testing.T) { } for _, tc := range testcases { - tc := tc t.Run(tc.name, func(t *testing.T) { textual, err := textual.NewSignModeHandler(textual.SignModeOptions{CoinMetadataQuerier: EmptyCoinMetadataQuerier}) require.NoError(t, err) diff --git a/x/upgrade/keeper/grpc_query_test.go b/x/upgrade/keeper/grpc_query_test.go index 2f799677273f..df97a2e72249 100644 --- a/x/upgrade/keeper/grpc_query_test.go +++ b/x/upgrade/keeper/grpc_query_test.go @@ -204,8 +204,6 @@ func (suite *UpgradeTestSuite) TestModuleVersions() { suite.Require().NoError(err) for _, tc := range testCases { - tc := tc - suite.Run(fmt.Sprintf("Case %s", tc.msg), func() { suite.SetupTest() // reset diff --git a/x/upgrade/keeper/keeper_test.go b/x/upgrade/keeper/keeper_test.go index 16b88d418a75..66297a3fe6d9 100644 --- a/x/upgrade/keeper/keeper_test.go +++ b/x/upgrade/keeper/keeper_test.go @@ -189,8 +189,6 @@ func (s *KeeperTestSuite) TestScheduleUpgrade() { } for _, tc := range cases { - tc := tc - s.Run(tc.name, func() { // reset suite s.SetupTest() diff --git a/x/upgrade/types/plan_test.go b/x/upgrade/types/plan_test.go index 423f12b1d47f..668528cfa69d 100644 --- a/x/upgrade/types/plan_test.go +++ b/x/upgrade/types/plan_test.go @@ -42,7 +42,6 @@ func TestPlanString(t *testing.T) { } for name, tc := range cases { - tc := tc // copy to local variable for scopelint t.Run(name, func(t *testing.T) { s := tc.p.String() require.Equal(t, tc.expect, s) @@ -93,7 +92,6 @@ func TestPlanValid(t *testing.T) { } for name, tc := range cases { - tc := tc // copy to local variable for scopelint t.Run(name, func(t *testing.T) { err := tc.p.ValidateBasic() if tc.valid { @@ -142,7 +140,6 @@ func TestShouldExecute(t *testing.T) { } for name, tc := range cases { - tc := tc // copy to local variable for scopelint t.Run(name, func(t *testing.T) { should := tc.p.ShouldExecute(tc.ctxHeight) assert.Equal(t, tc.expected, should) diff --git a/x/upgrade/types/storeloader_test.go b/x/upgrade/types/storeloader_test.go index d14d160f01ed..45e0b81df9fc 100644 --- a/x/upgrade/types/storeloader_test.go +++ b/x/upgrade/types/storeloader_test.go @@ -93,7 +93,6 @@ func TestSetLoader(t *testing.T) { v := []byte("value") for name, tc := range cases { - tc := tc t.Run(name, func(t *testing.T) { // prepare a db with some data db := coretesting.NewMemDB()