From a9546bfad0f165e3e45cb80d765449a2642512ab Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Fri, 31 Mar 2023 18:48:41 +0700 Subject: [PATCH] style: apply any / all automated lint fixes (#15644) --- client/v2/autocli/flag/coin.go | 1 + client/v2/autocli/flag/field.go | 1 + crypto/keys/bcrypt/bcrypt.go | 2 +- crypto/keys/secp256k1/secp256k1_internal_test.go | 2 +- internal/conv/string_test.go | 2 +- testutil/sims/simulation_helpers_test.go | 2 +- tools/rosetta/lib/server/server.go | 2 +- x/auth/keeper/keeper.go | 2 +- x/auth/simulation/proposals.go | 2 +- x/auth/types/account.go | 4 +--- x/auth/types/credentials.go | 1 - x/auth/vesting/types/msgs.go | 6 ------ x/authz/msgs.go | 6 ------ x/authz/simulation/operations.go | 6 +++--- x/bank/migrations/v3/store_test.go | 2 +- x/bank/simulation/operations.go | 8 ++++---- x/bank/simulation/proposals.go | 2 +- x/bank/types/msgs.go | 6 +----- x/bank/types/querier.go | 10 ---------- x/crisis/types/msgs.go | 2 -- x/distribution/simulation/operations.go | 8 ++++---- x/distribution/simulation/proposals.go | 2 +- x/distribution/types/genesis.go | 1 - x/distribution/types/query.go | 2 -- x/evidence/types/msgs.go | 2 -- x/feegrant/grant.go | 2 -- x/feegrant/msgs.go | 4 +--- x/gov/simulation/operations.go | 2 -- x/gov/types/v1/deposit.go | 2 -- x/gov/types/v1/msgs.go | 16 ++-------------- x/gov/types/v1/vote.go | 2 -- x/gov/types/v1beta1/deposit.go | 2 -- x/gov/types/v1beta1/msgs.go | 10 ++-------- x/gov/types/v1beta1/vote.go | 4 +--- x/group/simulation/operations.go | 2 -- x/mint/simulation/proposals.go | 2 +- x/nft/internal/conv/string_test.go | 2 +- x/slashing/simulation/proposals.go | 2 +- x/slashing/types/msg.go | 2 -- x/slashing/types/signing_info.go | 2 -- x/staking/keeper/delegation.go | 2 +- x/staking/simulation/operations.go | 2 -- x/staking/simulation/proposals.go | 2 +- x/staking/types/delegation.go | 7 ------- x/staking/types/msg.go | 12 +----------- x/staking/types/validator.go | 2 -- 46 files changed, 37 insertions(+), 130 deletions(-) diff --git a/client/v2/autocli/flag/coin.go b/client/v2/autocli/flag/coin.go index dfefcbd398..f2abd593ed 100644 --- a/client/v2/autocli/flag/coin.go +++ b/client/v2/autocli/flag/coin.go @@ -2,6 +2,7 @@ package flag import ( "context" + basev1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" "cosmossdk.io/core/coins" "google.golang.org/protobuf/reflect/protoreflect" diff --git a/client/v2/autocli/flag/field.go b/client/v2/autocli/flag/field.go index 83da021ec3..b2c385ac95 100644 --- a/client/v2/autocli/flag/field.go +++ b/client/v2/autocli/flag/field.go @@ -2,6 +2,7 @@ package flag import ( "context" + autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" cosmos_proto "github.com/cosmos/cosmos-proto" "github.com/spf13/pflag" diff --git a/crypto/keys/bcrypt/bcrypt.go b/crypto/keys/bcrypt/bcrypt.go index 7e2b0d0dc1..9badc4670c 100644 --- a/crypto/keys/bcrypt/bcrypt.go +++ b/crypto/keys/bcrypt/bcrypt.go @@ -210,7 +210,7 @@ func expensiveBlowfishSetup(key []byte, cost uint32, salt []byte) (*blowfish.Cip // Bug compatibility with C bcrypt implementations. They use the trailing // NULL in the key string during expansion. // We copy the key to prevent changing the underlying array. - ckey := append(key[:len(key):len(key)], 0) //nolint:gocritic // used in original https://cs.opensource.google/go/x/crypto/+/master:bcrypt/bcrypt.go + ckey := append(key[:len(key):len(key)], 0) c, err := blowfish.NewSaltedCipher(ckey, csalt) if err != nil { diff --git a/crypto/keys/secp256k1/secp256k1_internal_test.go b/crypto/keys/secp256k1/secp256k1_internal_test.go index 56bef18f6b..539420d00e 100644 --- a/crypto/keys/secp256k1/secp256k1_internal_test.go +++ b/crypto/keys/secp256k1/secp256k1_internal_test.go @@ -16,7 +16,7 @@ func Test_genPrivKey(t *testing.T) { copy(onePadded[32-len(oneB):32], oneB) t.Logf("one padded: %v, len=%v", onePadded, len(onePadded)) - validOne := append(empty, onePadded...) //nolint:gocritic // append is fine here + validOne := append(empty, onePadded...) tests := []struct { name string notSoRand []byte diff --git a/internal/conv/string_test.go b/internal/conv/string_test.go index 3e051d37b9..3a14517531 100644 --- a/internal/conv/string_test.go +++ b/internal/conv/string_test.go @@ -26,7 +26,7 @@ func (s *StringSuite) TestUnsafeStrToBytes() { b := unsafeConvertStr() runtime.GC() <-time.NewTimer(2 * time.Millisecond).C - b2 := append(b, 'd') //nolint:gocritic // append is fine here + b2 := append(b, 'd') s.Equal("abc", string(b)) s.Equal("abcd", string(b2)) } diff --git a/testutil/sims/simulation_helpers_test.go b/testutil/sims/simulation_helpers_test.go index 55cc77b439..d60a720f2e 100644 --- a/testutil/sims/simulation_helpers_test.go +++ b/testutil/sims/simulation_helpers_test.go @@ -85,7 +85,7 @@ func TestDiffKVStores(t *testing.T) { // Same keys, different value. Comparisons will be nil as prefixes are skipped. prefix := []byte("prefix:") - k1Prefixed := append(prefix, k1...) //nolint:gocritic // append is fine here + k1Prefixed := append(prefix, k1...) store1.Set(k1Prefixed, v1) store2.Set(k1Prefixed, v2) checkDiffResults(t, store1, store2) diff --git a/tools/rosetta/lib/server/server.go b/tools/rosetta/lib/server/server.go index c002fb795d..a0809fa8fe 100644 --- a/tools/rosetta/lib/server/server.go +++ b/tools/rosetta/lib/server/server.go @@ -45,7 +45,7 @@ type Server struct { func (h Server) Start() error { h.logger.Info(fmt.Sprintf("Rosetta server listening on add %s", h.addr)) - return http.ListenAndServe(h.addr, h.h) //nolint:gosec // users are recommended to operate a proxy in front of this server + return http.ListenAndServe(h.addr, h.h) //nolint:gosec // users are recommended to operate a proxy in front of this server } func NewServer(settings Settings) (Server, error) { diff --git a/x/auth/keeper/keeper.go b/x/auth/keeper/keeper.go index a758a70eb0..d217debcb2 100644 --- a/x/auth/keeper/keeper.go +++ b/x/auth/keeper/keeper.go @@ -251,7 +251,7 @@ func (ak AccountKeeper) decodeAccount(bz []byte) sdk.AccountI { } // MarshalAccount protobuf serializes an Account interface -func (ak AccountKeeper) MarshalAccount(accountI sdk.AccountI) ([]byte, error) { //nolint:interfacer +func (ak AccountKeeper) MarshalAccount(accountI sdk.AccountI) ([]byte, error) { return ak.cdc.MarshalInterface(accountI) } diff --git a/x/auth/simulation/proposals.go b/x/auth/simulation/proposals.go index 87746569c2..0e7cd95797 100644 --- a/x/auth/simulation/proposals.go +++ b/x/auth/simulation/proposals.go @@ -14,7 +14,7 @@ import ( const ( DefaultWeightMsgUpdateParams int = 100 - OpWeightMsgUpdateParams = "op_weight_msg_update_params" //nolint:gosec + OpWeightMsgUpdateParams = "op_weight_msg_update_params" ) // ProposalMsgs defines the module weighted proposals' contents diff --git a/x/auth/types/account.go b/x/auth/types/account.go index 8026bee1c1..9345d819d2 100644 --- a/x/auth/types/account.go +++ b/x/auth/types/account.go @@ -23,9 +23,7 @@ var ( _ sdk.ModuleAccountI = (*ModuleAccount)(nil) ) -// NewBaseAccount creates a new BaseAccount object -// -//nolint:interfacer +// NewBaseAccount creates a new BaseAccount object. func NewBaseAccount(address sdk.AccAddress, pubKey cryptotypes.PubKey, accountNumber, sequence uint64) *BaseAccount { acc := &BaseAccount{ Address: address.String(), diff --git a/x/auth/types/credentials.go b/x/auth/types/credentials.go index 83cd63dd29..4c63fc8d8c 100644 --- a/x/auth/types/credentials.go +++ b/x/auth/types/credentials.go @@ -27,7 +27,6 @@ func NewBaseAccountWithPubKey(pubkey cryptotypes.PubKey) (*BaseAccount, error) { return baseAccount, nil } -//nolint:gosec // this isn't an hardcoded credential const ModuleCredentialType = "ModuleCredential" var _ cryptotypes.PubKey = &ModuleCredential{} diff --git a/x/auth/vesting/types/msgs.go b/x/auth/vesting/types/msgs.go index 4bd31fdb9a..edf4e7b468 100644 --- a/x/auth/vesting/types/msgs.go +++ b/x/auth/vesting/types/msgs.go @@ -21,8 +21,6 @@ var ( ) // NewMsgCreateVestingAccount returns a reference to a new MsgCreateVestingAccount. -// -//nolint:interfacer func NewMsgCreateVestingAccount(fromAddr, toAddr sdk.AccAddress, amount sdk.Coins, endTime int64, delayed bool) *MsgCreateVestingAccount { return &MsgCreateVestingAccount{ FromAddress: fromAddr.String(), @@ -70,8 +68,6 @@ func (msg MsgCreateVestingAccount) GetSigners() []sdk.AccAddress { } // NewMsgCreatePermanentLockedAccount returns a reference to a new MsgCreatePermanentLockedAccount. -// -//nolint:interfacer func NewMsgCreatePermanentLockedAccount(fromAddr, toAddr sdk.AccAddress, amount sdk.Coins) *MsgCreatePermanentLockedAccount { return &MsgCreatePermanentLockedAccount{ FromAddress: fromAddr.String(), @@ -113,8 +109,6 @@ func (msg MsgCreatePermanentLockedAccount) GetSigners() []sdk.AccAddress { } // NewMsgCreatePeriodicVestingAccount returns a reference to a new MsgCreatePeriodicVestingAccount. -// -//nolint:interfacer func NewMsgCreatePeriodicVestingAccount(fromAddr, toAddr sdk.AccAddress, startTime int64, periods []Period) *MsgCreatePeriodicVestingAccount { return &MsgCreatePeriodicVestingAccount{ FromAddress: fromAddr.String(), diff --git a/x/authz/msgs.go b/x/authz/msgs.go index 32a598f127..b67aa174e3 100644 --- a/x/authz/msgs.go +++ b/x/authz/msgs.go @@ -28,8 +28,6 @@ var ( ) // NewMsgGrant creates a new MsgGrant -// -//nolint:interfacer func NewMsgGrant(granter, grantee sdk.AccAddress, a Authorization, expiration *time.Time) (*MsgGrant, error) { m := &MsgGrant{ Granter: granter.String(), @@ -109,8 +107,6 @@ func (msg MsgGrant) UnpackInterfaces(unpacker cdctypes.AnyUnpacker) error { } // NewMsgRevoke creates a new MsgRevoke -// -//nolint:interfacer func NewMsgRevoke(granter, grantee sdk.AccAddress, msgTypeURL string) MsgRevoke { return MsgRevoke{ Granter: granter.String(), @@ -153,8 +149,6 @@ func (msg MsgRevoke) GetSignBytes() []byte { } // NewMsgExec creates a new MsgExecAuthorized -// -//nolint:interfacer func NewMsgExec(grantee sdk.AccAddress, msgs []sdk.Msg) MsgExec { msgsAny := make([]*cdctypes.Any, len(msgs)) for i, msg := range msgs { diff --git a/x/authz/simulation/operations.go b/x/authz/simulation/operations.go index 33fe08dea0..6cb1f39b88 100644 --- a/x/authz/simulation/operations.go +++ b/x/authz/simulation/operations.go @@ -27,9 +27,9 @@ var ( // Simulation operation weights constants const ( - OpWeightMsgGrant = "op_weight_msg_grant" //nolint:gosec - OpWeightRevoke = "op_weight_msg_revoke" //nolint:gosec - OpWeightExec = "op_weight_msg_execute" //nolint:gosec + OpWeightMsgGrant = "op_weight_msg_grant" + OpWeightRevoke = "op_weight_msg_revoke" + OpWeightExec = "op_weight_msg_execute" ) // authz operations weights diff --git a/x/bank/migrations/v3/store_test.go b/x/bank/migrations/v3/store_test.go index 83ba288abf..312bc59b78 100644 --- a/x/bank/migrations/v3/store_test.go +++ b/x/bank/migrations/v3/store_test.go @@ -108,7 +108,7 @@ func TestMigrateDenomMetaData(t *testing.T) { newKey := denomMetadataIter.Key() // make sure old entry is deleted - oldKey := append(newKey, newKey[0:]...) //nolint:gocritic // append is ok here + oldKey := append(newKey, newKey[0:]...) bz := denomMetadataStore.Get(oldKey) require.Nil(t, bz) diff --git a/x/bank/simulation/operations.go b/x/bank/simulation/operations.go index 3f7a1b024d..5d5037a2b8 100644 --- a/x/bank/simulation/operations.go +++ b/x/bank/simulation/operations.go @@ -18,10 +18,10 @@ import ( // Simulation operation weights constants const ( - OpWeightMsgSend = "op_weight_msg_send" //nolint:gosec - OpWeightMsgMultiSend = "op_weight_msg_multisend" //nolint:gosec - DefaultWeightMsgSend = 100 // from simappparams.DefaultWeightMsgSend - DefaultWeightMsgMultiSend = 10 // from simappparams.DefaultWeightMsgMultiSend + OpWeightMsgSend = "op_weight_msg_send" + OpWeightMsgMultiSend = "op_weight_msg_multisend" + DefaultWeightMsgSend = 100 // from simappparams.DefaultWeightMsgSend + DefaultWeightMsgMultiSend = 10 // from simappparams.DefaultWeightMsgMultiSend ) // WeightedOperations returns all the operations from the module with their respective weights diff --git a/x/bank/simulation/proposals.go b/x/bank/simulation/proposals.go index 5a63b8632c..3843b5f256 100644 --- a/x/bank/simulation/proposals.go +++ b/x/bank/simulation/proposals.go @@ -14,7 +14,7 @@ import ( const ( DefaultWeightMsgUpdateParams int = 100 - OpWeightMsgUpdateParams = "op_weight_msg_update_params" //nolint:gosec + OpWeightMsgUpdateParams = "op_weight_msg_update_params" ) // ProposalMsgs defines the module weighted proposals' contents diff --git a/x/bank/types/msgs.go b/x/bank/types/msgs.go index 25ecdf50ce..5f8453bff7 100644 --- a/x/bank/types/msgs.go +++ b/x/bank/types/msgs.go @@ -20,7 +20,7 @@ var ( // NewMsgSend - construct a msg to send coins from one account to another. // -//nolint:interfacer + func NewMsgSend(fromAddr, toAddr sdk.AccAddress, amount sdk.Coins) *MsgSend { return &MsgSend{FromAddress: fromAddr.String(), ToAddress: toAddr.String(), Amount: amount} } @@ -116,8 +116,6 @@ func (in Input) ValidateBasic() error { } // NewInput - create a transaction input, used with MsgMultiSend -// -//nolint:interfacer func NewInput(addr sdk.AccAddress, coins sdk.Coins) Input { return Input{ Address: addr.String(), @@ -143,8 +141,6 @@ func (out Output) ValidateBasic() error { } // NewOutput - create a transaction output, used with MsgMultiSend -// -//nolint:interfacer func NewOutput(addr sdk.AccAddress, coins sdk.Coins) Output { return Output{ Address: addr.String(), diff --git a/x/bank/types/querier.go b/x/bank/types/querier.go index 6a36dedcbb..5303035c2b 100644 --- a/x/bank/types/querier.go +++ b/x/bank/types/querier.go @@ -14,37 +14,28 @@ const ( ) // NewQueryBalanceRequest creates a new instance of QueryBalanceRequest. -// -//nolint:interfacer func NewQueryBalanceRequest(addr sdk.AccAddress, denom string) *QueryBalanceRequest { return &QueryBalanceRequest{Address: addr.String(), Denom: denom} } // NewQueryAllBalancesRequest creates a new instance of QueryAllBalancesRequest. -// -//nolint:interfacer func NewQueryAllBalancesRequest(addr sdk.AccAddress, req *query.PageRequest, resolveDenom bool) *QueryAllBalancesRequest { return &QueryAllBalancesRequest{Address: addr.String(), Pagination: req, ResolveDenom: resolveDenom} } // NewQuerySpendableBalancesRequest creates a new instance of a // QuerySpendableBalancesRequest. -// -//nolint:interfacer func NewQuerySpendableBalancesRequest(addr sdk.AccAddress, req *query.PageRequest) *QuerySpendableBalancesRequest { return &QuerySpendableBalancesRequest{Address: addr.String(), Pagination: req} } // NewQuerySpendableBalanceByDenomRequest creates a new instance of a // QuerySpendableBalanceByDenomRequest. -// -//nolint:interfacer func NewQuerySpendableBalanceByDenomRequest(addr sdk.AccAddress, denom string) *QuerySpendableBalanceByDenomRequest { return &QuerySpendableBalanceByDenomRequest{Address: addr.String(), Denom: denom} } // QueryTotalSupplyParams defines the params for the following queries: -// // - 'custom/bank/totalSupply' type QueryTotalSupplyParams struct { Page, Limit int @@ -56,7 +47,6 @@ func NewQueryTotalSupplyParams(page, limit int) QueryTotalSupplyParams { } // QuerySupplyOfParams defines the params for the following queries: -// // - 'custom/bank/totalSupplyOf' type QuerySupplyOfParams struct { Denom string diff --git a/x/crisis/types/msgs.go b/x/crisis/types/msgs.go index 02ca572f45..e5a434bf20 100644 --- a/x/crisis/types/msgs.go +++ b/x/crisis/types/msgs.go @@ -15,8 +15,6 @@ var ( ) // NewMsgVerifyInvariant creates a new MsgVerifyInvariant object -// -//nolint:interfacer func NewMsgVerifyInvariant(sender sdk.AccAddress, invModeName, invRoute string) *MsgVerifyInvariant { return &MsgVerifyInvariant{ Sender: sender.String(), diff --git a/x/distribution/simulation/operations.go b/x/distribution/simulation/operations.go index 40165a3179..0a97faf3a1 100644 --- a/x/distribution/simulation/operations.go +++ b/x/distribution/simulation/operations.go @@ -19,10 +19,10 @@ import ( // Simulation operation weights constants const ( - OpWeightMsgSetWithdrawAddress = "op_weight_msg_set_withdraw_address" //nolint:gosec - OpWeightMsgWithdrawDelegationReward = "op_weight_msg_withdraw_delegation_reward" //nolint:gosec - OpWeightMsgWithdrawValidatorCommission = "op_weight_msg_withdraw_validator_commission" //nolint:gosec - OpWeightMsgFundCommunityPool = "op_weight_msg_fund_community_pool" //nolint:gosec + OpWeightMsgSetWithdrawAddress = "op_weight_msg_set_withdraw_address" + OpWeightMsgWithdrawDelegationReward = "op_weight_msg_withdraw_delegation_reward" + OpWeightMsgWithdrawValidatorCommission = "op_weight_msg_withdraw_validator_commission" + OpWeightMsgFundCommunityPool = "op_weight_msg_fund_community_pool" DefaultWeightMsgSetWithdrawAddress int = 50 DefaultWeightMsgWithdrawDelegationReward int = 50 diff --git a/x/distribution/simulation/proposals.go b/x/distribution/simulation/proposals.go index 6330691afc..858fa09e56 100644 --- a/x/distribution/simulation/proposals.go +++ b/x/distribution/simulation/proposals.go @@ -14,7 +14,7 @@ import ( const ( DefaultWeightMsgUpdateParams int = 50 - OpWeightMsgUpdateParams = "op_weight_msg_update_params" //nolint:gosec + OpWeightMsgUpdateParams = "op_weight_msg_update_params" ) // ProposalMsgs defines the module weighted proposals' contents diff --git a/x/distribution/types/genesis.go b/x/distribution/types/genesis.go index 9ceb0737a1..0affa8c347 100644 --- a/x/distribution/types/genesis.go +++ b/x/distribution/types/genesis.go @@ -4,7 +4,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -//nolint:interfacer func NewGenesisState( params Params, fp FeePool, dwis []DelegatorWithdrawInfo, pp sdk.ConsAddress, r []ValidatorOutstandingRewardsRecord, acc []ValidatorAccumulatedCommissionRecord, historical []ValidatorHistoricalRewardsRecord, diff --git a/x/distribution/types/query.go b/x/distribution/types/query.go index 38f6c0a352..e7efccd1e1 100644 --- a/x/distribution/types/query.go +++ b/x/distribution/types/query.go @@ -32,8 +32,6 @@ func (res QueryDelegatorTotalRewardsResponse) String() string { } // NewDelegationDelegatorReward constructs a DelegationDelegatorReward. -// -//nolint:interfacer func NewDelegationDelegatorReward(valAddr sdk.ValAddress, reward sdk.DecCoins) DelegationDelegatorReward { return DelegationDelegatorReward{ValidatorAddress: valAddr.String(), Reward: reward} } diff --git a/x/evidence/types/msgs.go b/x/evidence/types/msgs.go index f70dd01ae7..541cc372bd 100644 --- a/x/evidence/types/msgs.go +++ b/x/evidence/types/msgs.go @@ -21,8 +21,6 @@ var ( ) // NewMsgSubmitEvidence returns a new MsgSubmitEvidence with a signer/submitter. -// -//nolint:interfacer func NewMsgSubmitEvidence(s sdk.AccAddress, evi exported.Evidence) (*MsgSubmitEvidence, error) { msg, ok := evi.(proto.Message) if !ok { diff --git a/x/feegrant/grant.go b/x/feegrant/grant.go index 8ea74bbce6..56029b9ae2 100644 --- a/x/feegrant/grant.go +++ b/x/feegrant/grant.go @@ -13,8 +13,6 @@ import ( var _ types.UnpackInterfacesMessage = &Grant{} // NewGrant creates a new FeeAllowanceGrant. -// -//nolint:interfacer func NewGrant(granter, grantee sdk.AccAddress, feeAllowance FeeAllowanceI) (Grant, error) { msg, ok := feeAllowance.(proto.Message) if !ok { diff --git a/x/feegrant/msgs.go b/x/feegrant/msgs.go index 50bbc293bc..6d6c3578f5 100644 --- a/x/feegrant/msgs.go +++ b/x/feegrant/msgs.go @@ -20,8 +20,6 @@ var ( ) // NewMsgGrantAllowance creates a new MsgGrantAllowance. -// -//nolint:interfacer func NewMsgGrantAllowance(feeAllowance FeeAllowanceI, granter, grantee sdk.AccAddress) (*MsgGrantAllowance, error) { msg, ok := feeAllowance.(proto.Message) if !ok { @@ -74,7 +72,7 @@ func (msg MsgGrantAllowance) UnpackInterfaces(unpacker types.AnyUnpacker) error // NewMsgRevokeAllowance returns a message to revoke a fee allowance for a given // granter and grantee // -//nolint:interfacer + func NewMsgRevokeAllowance(granter, grantee sdk.AccAddress) MsgRevokeAllowance { return MsgRevokeAllowance{Granter: granter.String(), Grantee: grantee.String()} } diff --git a/x/gov/simulation/operations.go b/x/gov/simulation/operations.go index 4ea36900e7..8f9cd4b1b7 100644 --- a/x/gov/simulation/operations.go +++ b/x/gov/simulation/operations.go @@ -29,8 +29,6 @@ var ( ) // Simulation operation weights constants -// -//nolint:gosec // these are not hard-coded credentials. const ( OpWeightMsgDeposit = "op_weight_msg_deposit" OpWeightMsgVote = "op_weight_msg_vote" diff --git a/x/gov/types/v1/deposit.go b/x/gov/types/v1/deposit.go index 03c02ba471..2ddbd8c221 100644 --- a/x/gov/types/v1/deposit.go +++ b/x/gov/types/v1/deposit.go @@ -7,8 +7,6 @@ import ( ) // NewDeposit creates a new Deposit instance -// -//nolint:interfacer func NewDeposit(proposalID uint64, depositor sdk.AccAddress, amount sdk.Coins) Deposit { return Deposit{proposalID, depositor.String(), amount} } diff --git a/x/gov/types/v1/msgs.go b/x/gov/types/v1/msgs.go index ac10428e23..6324fc000e 100644 --- a/x/gov/types/v1/msgs.go +++ b/x/gov/types/v1/msgs.go @@ -23,8 +23,6 @@ var ( ) // NewMsgSubmitProposal creates a new MsgSubmitProposal. -// -//nolint:interfacer func NewMsgSubmitProposal( messages []sdk.Msg, initialDeposit sdk.Coins, @@ -127,8 +125,6 @@ func (m MsgSubmitProposal) UnpackInterfaces(unpacker codectypes.AnyUnpacker) err } // NewMsgDeposit creates a new MsgDeposit instance -// -//nolint:interfacer func NewMsgDeposit(depositor sdk.AccAddress, proposalID uint64, amount sdk.Coins) *MsgDeposit { return &MsgDeposit{proposalID, depositor.String(), amount} } @@ -162,8 +158,6 @@ func (msg MsgDeposit) GetSigners() []sdk.AccAddress { } // NewMsgVote creates a message to cast a vote on an active proposal -// -//nolint:interfacer func NewMsgVote(voter sdk.AccAddress, proposalID uint64, option VoteOption, metadata string) *MsgVote { return &MsgVote{proposalID, voter.String(), option, metadata} } @@ -193,8 +187,6 @@ func (msg MsgVote) GetSigners() []sdk.AccAddress { } // NewMsgVoteWeighted creates a message to cast a vote on an active proposal -// -//nolint:interfacer func NewMsgVoteWeighted(voter sdk.AccAddress, proposalID uint64, options WeightedVoteOptions, metadata string) *MsgVoteWeighted { return &MsgVoteWeighted{proposalID, voter.String(), options, metadata} } @@ -248,9 +240,7 @@ func (msg MsgVoteWeighted) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{voter} } -// NewMsgExecLegacyContent creates a new MsgExecLegacyContent instance -// -//nolint:interfacer +// NewMsgExecLegacyContent creates a new MsgExecLegacyContent instance. func NewMsgExecLegacyContent(content *codectypes.Any, authority string) *MsgExecLegacyContent { return &MsgExecLegacyContent{ Content: content, @@ -307,9 +297,7 @@ func (msg MsgUpdateParams) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{authority} } -// NewMsgCancelProposal creates a new MsgCancelProposal instance -// -//nolint:interfacer +// NewMsgCancelProposal creates a new MsgCancelProposal instance. func NewMsgCancelProposal(proposalID uint64, proposer string) *MsgCancelProposal { return &MsgCancelProposal{ ProposalId: proposalID, diff --git a/x/gov/types/v1/vote.go b/x/gov/types/v1/vote.go index cb1f9066fc..77e24dfe84 100644 --- a/x/gov/types/v1/vote.go +++ b/x/gov/types/v1/vote.go @@ -18,8 +18,6 @@ const ( ) // NewVote creates a new Vote instance -// -//nolint:interfacer func NewVote(proposalID uint64, voter sdk.AccAddress, options WeightedVoteOptions, metadata string) Vote { return Vote{ProposalId: proposalID, Voter: voter.String(), Options: options, Metadata: metadata} } diff --git a/x/gov/types/v1beta1/deposit.go b/x/gov/types/v1beta1/deposit.go index ee05ae7a09..c9945b4209 100644 --- a/x/gov/types/v1beta1/deposit.go +++ b/x/gov/types/v1beta1/deposit.go @@ -7,8 +7,6 @@ import ( ) // NewDeposit creates a new Deposit instance -// -//nolint:interfacer func NewDeposit(proposalID uint64, depositor sdk.AccAddress, amount sdk.Coins) Deposit { return Deposit{proposalID, depositor.String(), amount} } diff --git a/x/gov/types/v1beta1/msgs.go b/x/gov/types/v1beta1/msgs.go index c02b93fd9b..ce4b68c114 100644 --- a/x/gov/types/v1beta1/msgs.go +++ b/x/gov/types/v1beta1/msgs.go @@ -32,8 +32,6 @@ var ( ) // NewMsgSubmitProposal creates a new MsgSubmitProposal. -// -//nolint:interfacer func NewMsgSubmitProposal(content Content, initialDeposit sdk.Coins, proposer sdk.AccAddress) (*MsgSubmitProposal, error) { m := &MsgSubmitProposal{ InitialDeposit: initialDeposit, @@ -134,7 +132,7 @@ func (m MsgSubmitProposal) UnpackInterfaces(unpacker codectypes.AnyUnpacker) err // NewMsgDeposit creates a new MsgDeposit instance // -//nolint:interfacer + func NewMsgDeposit(depositor sdk.AccAddress, proposalID uint64, amount sdk.Coins) *MsgDeposit { return &MsgDeposit{proposalID, depositor.String(), amount} } @@ -167,8 +165,6 @@ func (msg MsgDeposit) GetSigners() []sdk.AccAddress { } // NewMsgVote creates a message to cast a vote on an active proposal -// -//nolint:interfacer func NewMsgVote(voter sdk.AccAddress, proposalID uint64, option VoteOption) *MsgVote { return &MsgVote{proposalID, voter.String(), option} } @@ -197,9 +193,7 @@ func (msg MsgVote) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{voter} } -// NewMsgVoteWeighted creates a message to cast a vote on an active proposal -// -//nolint:interfacer +// NewMsgVoteWeighted creates a message to cast a vote on an active proposal. func NewMsgVoteWeighted(voter sdk.AccAddress, proposalID uint64, options WeightedVoteOptions) *MsgVoteWeighted { return &MsgVoteWeighted{proposalID, voter.String(), options} } diff --git a/x/gov/types/v1beta1/vote.go b/x/gov/types/v1beta1/vote.go index 25c959894b..6e3ff35b3b 100644 --- a/x/gov/types/v1beta1/vote.go +++ b/x/gov/types/v1beta1/vote.go @@ -9,9 +9,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -// NewVote creates a new Vote instance -// -//nolint:interfacer +// NewVote creates a new Vote instance. func NewVote(proposalID uint64, voter sdk.AccAddress, options WeightedVoteOptions) Vote { return Vote{ProposalId: proposalID, Voter: voter.String(), Options: options} } diff --git a/x/group/simulation/operations.go b/x/group/simulation/operations.go index 9b19fd692f..9e8e6fd127 100644 --- a/x/group/simulation/operations.go +++ b/x/group/simulation/operations.go @@ -41,8 +41,6 @@ var ( ) // Simulation operation weights constants -// -//nolint:gosec // these are not hardcoded credentials. const ( OpMsgCreateGroup = "op_weight_msg_create_group" OpMsgUpdateGroupAdmin = "op_weight_msg_update_group_admin" diff --git a/x/mint/simulation/proposals.go b/x/mint/simulation/proposals.go index 129658adcf..0ecf4a5591 100644 --- a/x/mint/simulation/proposals.go +++ b/x/mint/simulation/proposals.go @@ -14,7 +14,7 @@ import ( const ( DefaultWeightMsgUpdateParams int = 100 - OpWeightMsgUpdateParams = "op_weight_msg_update_params" //nolint:gosec + OpWeightMsgUpdateParams = "op_weight_msg_update_params" ) // ProposalMsgs defines the module weighted proposals' contents diff --git a/x/nft/internal/conv/string_test.go b/x/nft/internal/conv/string_test.go index 3e051d37b9..3a14517531 100644 --- a/x/nft/internal/conv/string_test.go +++ b/x/nft/internal/conv/string_test.go @@ -26,7 +26,7 @@ func (s *StringSuite) TestUnsafeStrToBytes() { b := unsafeConvertStr() runtime.GC() <-time.NewTimer(2 * time.Millisecond).C - b2 := append(b, 'd') //nolint:gocritic // append is fine here + b2 := append(b, 'd') s.Equal("abc", string(b)) s.Equal("abcd", string(b2)) } diff --git a/x/slashing/simulation/proposals.go b/x/slashing/simulation/proposals.go index 6c17b9c44a..86b5d5a532 100644 --- a/x/slashing/simulation/proposals.go +++ b/x/slashing/simulation/proposals.go @@ -15,7 +15,7 @@ import ( const ( DefaultWeightMsgUpdateParams int = 100 - OpWeightMsgUpdateParams = "op_weight_msg_update_params" //nolint:gosec + OpWeightMsgUpdateParams = "op_weight_msg_update_params" ) // ProposalMsgs defines the module weighted proposals' contents diff --git a/x/slashing/types/msg.go b/x/slashing/types/msg.go index 416e9b3077..db8dc4c489 100644 --- a/x/slashing/types/msg.go +++ b/x/slashing/types/msg.go @@ -18,8 +18,6 @@ var ( ) // NewMsgUnjail creates a new MsgUnjail instance -// -//nolint:interfacer func NewMsgUnjail(validatorAddr sdk.ValAddress) *MsgUnjail { return &MsgUnjail{ ValidatorAddr: validatorAddr.String(), diff --git a/x/slashing/types/signing_info.go b/x/slashing/types/signing_info.go index 27ed54e0b8..8e9519d51d 100644 --- a/x/slashing/types/signing_info.go +++ b/x/slashing/types/signing_info.go @@ -8,8 +8,6 @@ import ( ) // NewValidatorSigningInfo creates a new ValidatorSigningInfo instance -// -//nolint:interfacer func NewValidatorSigningInfo( consAddr sdk.ConsAddress, startHeight, indexOffset int64, jailedUntil time.Time, tombstoned bool, missedBlocksCounter int64, diff --git a/x/staking/keeper/delegation.go b/x/staking/keeper/delegation.go index 5093688b5b..acea5c3787 100644 --- a/x/staking/keeper/delegation.go +++ b/x/staking/keeper/delegation.go @@ -57,7 +57,7 @@ func (k Keeper) GetAllDelegations(ctx sdk.Context) (delegations []types.Delegati // GetValidatorDelegations returns all delegations to a specific validator. // Useful for querier. -func (k Keeper) GetValidatorDelegations(ctx sdk.Context, valAddr sdk.ValAddress) (delegations []types.Delegation) { //nolint:interfacer +func (k Keeper) GetValidatorDelegations(ctx sdk.Context, valAddr sdk.ValAddress) (delegations []types.Delegation) { store := ctx.KVStore(k.storeKey) iterator := storetypes.KVStorePrefixIterator(store, types.DelegationKey) diff --git a/x/staking/simulation/operations.go b/x/staking/simulation/operations.go index 18794553b0..0479f07d28 100644 --- a/x/staking/simulation/operations.go +++ b/x/staking/simulation/operations.go @@ -17,8 +17,6 @@ import ( ) // Simulation operation weights constants -// -//nolint:gosec // these are not hardcoded credentials const ( DefaultWeightMsgCreateValidator int = 100 DefaultWeightMsgEditValidator int = 5 diff --git a/x/staking/simulation/proposals.go b/x/staking/simulation/proposals.go index 6b1f431282..5ef5fc7a13 100644 --- a/x/staking/simulation/proposals.go +++ b/x/staking/simulation/proposals.go @@ -15,7 +15,7 @@ import ( const ( DefaultWeightMsgUpdateParams int = 100 - OpWeightMsgUpdateParams = "op_weight_msg_update_params" //nolint:gosec + OpWeightMsgUpdateParams = "op_weight_msg_update_params" ) // ProposalMsgs defines the module weighted proposals' contents diff --git a/x/staking/types/delegation.go b/x/staking/types/delegation.go index f993d9dc28..3fd63b2616 100644 --- a/x/staking/types/delegation.go +++ b/x/staking/types/delegation.go @@ -14,8 +14,6 @@ import ( var _ DelegationI = Delegation{} // NewDelegation creates a new delegation object -// -//nolint:interfacer func NewDelegation(delegatorAddr sdk.AccAddress, validatorAddr sdk.ValAddress, shares sdk.Dec) Delegation { return Delegation{ DelegatorAddress: delegatorAddr.String(), @@ -115,8 +113,6 @@ func UnmarshalUBDE(cdc codec.BinaryCodec, value []byte) (ubd UnbondingDelegation } // NewUnbondingDelegation - create a new unbonding delegation object -// -//nolint:interfacer func NewUnbondingDelegation( delegatorAddr sdk.AccAddress, validatorAddr sdk.ValAddress, creationHeight int64, minTime time.Time, balance math.Int, id uint64, @@ -213,7 +209,6 @@ func (e RedelegationEntry) OnHold() bool { return e.UnbondingOnHoldRefCount > 0 } -//nolint:interfacer func NewRedelegation( delegatorAddr sdk.AccAddress, validatorSrcAddr, validatorDstAddr sdk.ValAddress, creationHeight int64, minTime time.Time, balance math.Int, sharesDst sdk.Dec, id uint64, @@ -311,8 +306,6 @@ func (d DelegationResponses) String() (out string) { } // NewRedelegationResponse crates a new RedelegationEntryResponse instance. -// -//nolint:interfacer func NewRedelegationResponse( delegatorAddr sdk.AccAddress, validatorSrc, validatorDst sdk.ValAddress, entries []RedelegationEntryResponse, ) RedelegationResponse { diff --git a/x/staking/types/msg.go b/x/staking/types/msg.go index 1cd7767266..5a8a765020 100644 --- a/x/staking/types/msg.go +++ b/x/staking/types/msg.go @@ -33,7 +33,7 @@ var ( // NewMsgCreateValidator creates a new MsgCreateValidator instance. // Delegator address and validator address are the same. func NewMsgCreateValidator( - valAddr sdk.ValAddress, pubKey cryptotypes.PubKey, //nolint:interfacer + valAddr sdk.ValAddress, pubKey cryptotypes.PubKey, selfDelegation sdk.Coin, description Description, commission CommissionRates, minSelfDelegation math.Int, ) (*MsgCreateValidator, error) { var pkAny *codectypes.Any @@ -120,8 +120,6 @@ func (msg MsgCreateValidator) UnpackInterfaces(unpacker codectypes.AnyUnpacker) } // NewMsgEditValidator creates a new MsgEditValidator instance -// -//nolint:interfacer func NewMsgEditValidator(valAddr sdk.ValAddress, description Description, newRate *sdk.Dec, newMinSelfDelegation *math.Int) *MsgEditValidator { return &MsgEditValidator{ Description: description, @@ -170,8 +168,6 @@ func (msg MsgEditValidator) ValidateBasic() error { } // NewMsgDelegate creates a new MsgDelegate instance. -// -//nolint:interfacer func NewMsgDelegate(delAddr sdk.AccAddress, valAddr sdk.ValAddress, amount sdk.Coin) *MsgDelegate { return &MsgDelegate{ DelegatorAddress: delAddr.String(), @@ -212,8 +208,6 @@ func (msg MsgDelegate) ValidateBasic() error { } // NewMsgBeginRedelegate creates a new MsgBeginRedelegate instance. -// -//nolint:interfacer func NewMsgBeginRedelegate( delAddr sdk.AccAddress, valSrcAddr, valDstAddr sdk.ValAddress, amount sdk.Coin, ) *MsgBeginRedelegate { @@ -260,8 +254,6 @@ func (msg MsgBeginRedelegate) ValidateBasic() error { } // NewMsgUndelegate creates a new MsgUndelegate instance. -// -//nolint:interfacer func NewMsgUndelegate(delAddr sdk.AccAddress, valAddr sdk.ValAddress, amount sdk.Coin) *MsgUndelegate { return &MsgUndelegate{ DelegatorAddress: delAddr.String(), @@ -302,8 +294,6 @@ func (msg MsgUndelegate) ValidateBasic() error { } // NewMsgCancelUnbondingDelegation creates a new MsgCancelUnbondingDelegation instance. -// -//nolint:interfacer func NewMsgCancelUnbondingDelegation(delAddr sdk.AccAddress, valAddr sdk.ValAddress, creationHeight int64, amount sdk.Coin) *MsgCancelUnbondingDelegation { return &MsgCancelUnbondingDelegation{ DelegatorAddress: delAddr.String(), diff --git a/x/staking/types/validator.go b/x/staking/types/validator.go index c763998dc7..1b55f7120c 100644 --- a/x/staking/types/validator.go +++ b/x/staking/types/validator.go @@ -39,8 +39,6 @@ var ( var _ ValidatorI = Validator{} // NewValidator constructs a new Validator -// -//nolint:interfacer func NewValidator(operator sdk.ValAddress, pubKey cryptotypes.PubKey, description Description) (Validator, error) { pkAny, err := codectypes.NewAnyWithValue(pubKey) if err != nil {