diff --git a/client/v2/autocli/common.go b/client/v2/autocli/common.go index d7a462ff23..610d59c9e5 100644 --- a/client/v2/autocli/common.go +++ b/client/v2/autocli/common.go @@ -121,5 +121,5 @@ func (b *Builder) outOrStdoutFormat(cmd *cobra.Command, out []byte) error { } _, err = fmt.Fprintln(cmd.OutOrStdout(), string(out)) - return nil + return err } diff --git a/client/v2/autocli/flag/duration.go b/client/v2/autocli/flag/duration.go index 5e02c00d29..cf9fe67af4 100644 --- a/client/v2/autocli/flag/duration.go +++ b/client/v2/autocli/flag/duration.go @@ -10,11 +10,11 @@ import ( type durationType struct{} -func (t durationType) NewValue(context.Context, *Builder) Value { +func (d durationType) NewValue(context.Context, *Builder) Value { return &durationValue{} } -func (t durationType) DefaultValue() string { +func (d durationType) DefaultValue() string { return "" } @@ -22,30 +22,30 @@ type durationValue struct { value *durationpb.Duration } -func (a durationValue) Get(protoreflect.Value) (protoreflect.Value, error) { - if a.value == nil { +func (d durationValue) Get(protoreflect.Value) (protoreflect.Value, error) { + if d.value == nil { return protoreflect.Value{}, nil } - return protoreflect.ValueOfMessage(a.value.ProtoReflect()), nil + return protoreflect.ValueOfMessage(d.value.ProtoReflect()), nil } -func (v durationValue) String() string { - if v.value == nil { +func (d durationValue) String() string { + if d.value == nil { return "" } - return v.value.AsDuration().String() + return d.value.AsDuration().String() } -func (v *durationValue) Set(s string) error { +func (d *durationValue) Set(s string) error { dur, err := time.ParseDuration(s) if err != nil { return err } - v.value = durationpb.New(dur) + d.value = durationpb.New(dur) return nil } -func (v durationValue) Type() string { +func (d durationValue) Type() string { return "duration" } diff --git a/client/v2/autocli/flag/timestamp.go b/client/v2/autocli/flag/timestamp.go index 799dab4f32..c759c70f21 100644 --- a/client/v2/autocli/flag/timestamp.go +++ b/client/v2/autocli/flag/timestamp.go @@ -29,22 +29,22 @@ func (t timestampValue) Get(protoreflect.Value) (protoreflect.Value, error) { return protoreflect.ValueOfMessage(t.value.ProtoReflect()), nil } -func (v timestampValue) String() string { - if v.value == nil { +func (t timestampValue) String() string { + if t.value == nil { return "" } - return v.value.AsTime().Format(time.RFC3339) + return t.value.AsTime().Format(time.RFC3339) } -func (v *timestampValue) Set(s string) error { - t, err := time.Parse(time.RFC3339, s) +func (t *timestampValue) Set(s string) error { + time, err := time.Parse(time.RFC3339, s) if err != nil { return err } - v.value = timestamppb.New(t) + t.value = timestamppb.New(time) return nil } -func (v timestampValue) Type() string { +func (t timestampValue) Type() string { return "timestamp (RFC 3339)" } diff --git a/client/v2/autocli/msg_test.go b/client/v2/autocli/msg_test.go index 58925321ec..1bd0d11bc7 100644 --- a/client/v2/autocli/msg_test.go +++ b/client/v2/autocli/msg_test.go @@ -367,7 +367,3 @@ func TestEnhanceMessageCommand(t *testing.T) { err = b.enhanceCommandCommon(cmd, options, customCommands, enhanceMsg) assert.NilError(t, err) } - -type testMessageServer struct { - testpb.UnimplementedMsgServer -} diff --git a/log/bench_test.go b/log/bench_test.go index be3d02274b..d1dd9d8e64 100644 --- a/log/bench_test.go +++ b/log/bench_test.go @@ -134,7 +134,7 @@ func BenchmarkLoggers_StructuredVsFields(b *testing.B) { b.Run("logger structured", func(b *testing.B) { zl := zerolog.New(io.Discard) - var logger = log.NewCustomLogger(zl) + logger := log.NewCustomLogger(zl) zerolog := logger.Impl().(*zerolog.Logger) for i := 0; i < b.N; i++ { zerolog.Info().Int64("foo", 100000).Msg(message) @@ -150,7 +150,7 @@ func BenchmarkLoggers_StructuredVsFields(b *testing.B) { b.Run("logger", func(b *testing.B) { zl := zerolog.New(io.Discard) - var logger = log.NewCustomLogger(zl) + logger := log.NewCustomLogger(zl) for i := 0; i < b.N; i++ { logger.Info(message, "foo", 100000) logger.Info(message, "foo", "foo") diff --git a/x/bank/keeper/keeper_test.go b/x/bank/keeper/keeper_test.go index 28bf17fe80..860d169dac 100644 --- a/x/bank/keeper/keeper_test.go +++ b/x/bank/keeper/keeper_test.go @@ -321,18 +321,18 @@ func (suite *KeeperTestSuite) TestSupply_SendCoins() { authKeeper.EXPECT().GetModuleAddress("").Return(nil) require.Panics(func() { - _ = keeper.SendCoinsFromModuleToModule(ctx, "", holderAcc.GetName(), initCoins) //nolint:errcheck + _ = keeper.SendCoinsFromModuleToModule(ctx, "", holderAcc.GetName(), initCoins) //nolint:errcheck // we're testing for a panic, not an error }) authKeeper.EXPECT().GetModuleAddress(burnerAcc.Name).Return(burnerAcc.GetAddress()) authKeeper.EXPECT().GetModuleAccount(ctx, "").Return(nil) require.Panics(func() { - _ = keeper.SendCoinsFromModuleToModule(ctx, authtypes.Burner, "", initCoins) //nolint:errcheck + _ = keeper.SendCoinsFromModuleToModule(ctx, authtypes.Burner, "", initCoins) //nolint:errcheck // we're testing for a panic, not an error }) authKeeper.EXPECT().GetModuleAddress("").Return(nil) require.Panics(func() { - _ = keeper.SendCoinsFromModuleToAccount(ctx, "", baseAcc.GetAddress(), initCoins) //nolint:errcheck + _ = keeper.SendCoinsFromModuleToAccount(ctx, "", baseAcc.GetAddress(), initCoins) //nolint:errcheck // we're testing for a panic, not an error }) authKeeper.EXPECT().GetModuleAddress(holderAcc.Name).Return(holderAcc.GetAddress()) @@ -371,16 +371,16 @@ func (suite *KeeperTestSuite) TestSupply_MintCoins() { require.NoError(err) authKeeper.EXPECT().GetModuleAccount(ctx, "").Return(nil) - require.Panics(func() { _ = keeper.MintCoins(ctx, "", initCoins) }, "no module account") //nolint:errcheck + require.Panics(func() { _ = keeper.MintCoins(ctx, "", initCoins) }, "no module account") //nolint:errcheck // we're testing for a panic, not an error suite.mockMintCoins(burnerAcc) - require.Panics(func() { _ = keeper.MintCoins(ctx, authtypes.Burner, initCoins) }, "invalid permission") //nolint:errcheck + require.Panics(func() { _ = keeper.MintCoins(ctx, authtypes.Burner, initCoins) }, "invalid permission") //nolint:errcheck // we're testing for a panic, not an error suite.mockMintCoins(minterAcc) require.Error(keeper.MintCoins(ctx, authtypes.Minter, sdk.Coins{sdk.Coin{Denom: "denom", Amount: sdk.NewInt(-10)}}), "insufficient coins") authKeeper.EXPECT().GetModuleAccount(ctx, randomPerm).Return(nil) - require.Panics(func() { _ = keeper.MintCoins(ctx, randomPerm, initCoins) }) //nolint:errcheck + require.Panics(func() { _ = keeper.MintCoins(ctx, randomPerm, initCoins) }) //nolint:errcheck // we're testing for a panic, not an error suite.mockMintCoins(minterAcc) require.NoError(keeper.MintCoins(ctx, authtypes.Minter, initCoins)) @@ -424,13 +424,13 @@ func (suite *KeeperTestSuite) TestSupply_BurnCoins() { require.NoError(err) authKeeper.EXPECT().GetModuleAccount(ctx, "").Return(nil) - require.Panics(func() { _ = keeper.BurnCoins(ctx, "", initCoins) }, "no module account") //nolint:errcheck + require.Panics(func() { _ = keeper.BurnCoins(ctx, "", initCoins) }, "no module account") //nolint:errcheck // we're testing for a panic, not an error authKeeper.EXPECT().GetModuleAccount(ctx, minterAcc.Name).Return(nil) - require.Panics(func() { _ = keeper.BurnCoins(ctx, authtypes.Minter, initCoins) }, "invalid permission") //nolint:errcheck + require.Panics(func() { _ = keeper.BurnCoins(ctx, authtypes.Minter, initCoins) }, "invalid permission") //nolint:errcheck // we're testing for a panic, not an error authKeeper.EXPECT().GetModuleAccount(ctx, randomPerm).Return(nil) - require.Panics(func() { _ = keeper.BurnCoins(ctx, randomPerm, supplyAfterInflation) }, "random permission") //nolint:errcheck + require.Panics(func() { _ = keeper.BurnCoins(ctx, randomPerm, supplyAfterInflation) }, "random permission") //nolint:errcheck // we're testing for a panic, not an error suite.mockBurnCoins(burnerAcc) require.Error(keeper.BurnCoins(ctx, authtypes.Burner, supplyAfterInflation), "insufficient coins") diff --git a/x/bank/module.go b/x/bank/module.go index 63d6319ff4..adfea3c183 100644 --- a/x/bank/module.go +++ b/x/bank/module.go @@ -206,8 +206,7 @@ func init() { ) } -//nolint:revive -type BankInputs struct { +type ModuleInputs struct { depinject.In Config *modulev1.Module @@ -220,15 +219,14 @@ type BankInputs struct { LegacySubspace exported.Subspace `optional:"true"` } -//nolint:revive -type BankOutputs struct { +type ModuleOutputs struct { depinject.Out BankKeeper keeper.BaseKeeper Module appmodule.AppModule } -func ProvideModule(in BankInputs) BankOutputs { +func ProvideModule(in ModuleInputs) ModuleOutputs { // Configure blocked module accounts. // // Default behavior for blockedAddresses is to regard any module mentioned in @@ -259,5 +257,5 @@ func ProvideModule(in BankInputs) BankOutputs { ) m := NewAppModule(in.Cdc, bankKeeper, in.AccountKeeper, in.LegacySubspace) - return BankOutputs{BankKeeper: bankKeeper, Module: m} + return ModuleOutputs{BankKeeper: bankKeeper, Module: m} } diff --git a/x/bank/simulation/genesis_test.go b/x/bank/simulation/genesis_test.go index 76be7256f8..ef036617db 100644 --- a/x/bank/simulation/genesis_test.go +++ b/x/bank/simulation/genesis_test.go @@ -43,7 +43,7 @@ func TestRandomizedGenState(t *testing.T) { simState.Cdc.MustUnmarshalJSON(simState.GenState[types.ModuleName], &bankGenesis) assert.Equal(t, true, bankGenesis.Params.GetDefaultSendEnabled(), "Params.GetDefaultSendEnabled") - assert.Len(t, bankGenesis.Params.GetSendEnabled(), 0, "Params.GetSendEnabled") //nolint:staticcheck + assert.Len(t, bankGenesis.Params.GetSendEnabled(), 0, "Params.GetSendEnabled") //nolint:staticcheck // we're testing deprecated code here if assert.Len(t, bankGenesis.Balances, 3) { assert.Equal(t, "cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r", bankGenesis.Balances[2].GetAddress().String(), "Balances[2] address") assert.Equal(t, "1000stake", bankGenesis.Balances[2].GetCoins().String(), "Balances[2] coins") diff --git a/x/bank/simulation/proposals_test.go b/x/bank/simulation/proposals_test.go index cc9ca7e55c..5365a4fbf6 100644 --- a/x/bank/simulation/proposals_test.go +++ b/x/bank/simulation/proposals_test.go @@ -39,6 +39,6 @@ func TestProposalMsgs(t *testing.T) { fmt.Println(msgUpdateParams) assert.Equal(t, sdk.AccAddress(address.Module("gov")).String(), msgUpdateParams.Authority) - assert.Assert(t, len(msgUpdateParams.Params.SendEnabled) == 0) //nolint:staticcheck + assert.Assert(t, len(msgUpdateParams.Params.SendEnabled) == 0) //nolint:staticcheck // we're testing deprecated code here assert.Equal(t, true, msgUpdateParams.Params.DefaultSendEnabled) } diff --git a/x/bank/types/codec.go b/x/bank/types/codec.go index d23ef9c623..c7d539fcf4 100644 --- a/x/bank/types/codec.go +++ b/x/bank/types/codec.go @@ -41,7 +41,7 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { var ( amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewAminoCodec(amino) + ModuleCdc = codec.NewAminoCodec(amino) //nolint:staticcheck // TODO: remove once amino is removed ) func init() { diff --git a/x/gov/client/testutil/helpers.go b/x/gov/client/testutil/helpers.go index 7f87eeaab5..c772126c4b 100644 --- a/x/gov/client/testutil/helpers.go +++ b/x/gov/client/testutil/helpers.go @@ -4,7 +4,7 @@ import ( "fmt" sdkmath "cosmossdk.io/math" - + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/testutil" diff --git a/x/nft/client/cli/tx_test.go b/x/nft/client/cli/tx_test.go index 5d78c89d69..ebf87e9456 100644 --- a/x/nft/client/cli/tx_test.go +++ b/x/nft/client/cli/tx_test.go @@ -189,7 +189,7 @@ func (s *CLITestSuite) TestCLITxSend() { for _, tc := range testCases { tc := tc s.Run(tc.name, func() { - args := append(tc.args, extraArgs...) //nolint:gocritic // false positive + args := append(tc.args, extraArgs...) cmd := cli.NewCmdSend() cmd.SetContext(s.ctx) cmd.SetArgs(args) diff --git a/x/nft/simulation/operations.go b/x/nft/simulation/operations.go index 7667d70673..219bd23b75 100644 --- a/x/nft/simulation/operations.go +++ b/x/nft/simulation/operations.go @@ -18,7 +18,7 @@ import ( const ( // OpWeightMsgSend Simulation operation weights constants - OpWeightMsgSend = "op_weight_msg_send" //nolint:gosec + OpWeightMsgSend = "op_weight_msg_send" // WeightSend nft operations weights WeightSend = 100