From a0c00b243d1d8095721e13953c839677fb222073 Mon Sep 17 00:00:00 2001 From: huangyi Date: Mon, 22 Jul 2024 09:51:45 +0800 Subject: [PATCH] fix lint --- .golangci.yml | 2 -- cmd/chain-maind/app/app.go | 3 +-- x/icaauth/keeper/keeper.go | 7 +------ x/nft-transfer/types/codec.go | 5 +---- x/nft/types/codec.go | 9 ++++----- 5 files changed, 7 insertions(+), 19 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 5341b7cb3..dc5eb9f92 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -37,8 +37,6 @@ issues: linters-settings: exclude: ./pystarport/* - govet: - check-shadowing: true errcheck: # report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`; # default is false: such cases aren't reported by default. diff --git a/cmd/chain-maind/app/app.go b/cmd/chain-maind/app/app.go index 6c42892e0..438d11be0 100644 --- a/cmd/chain-maind/app/app.go +++ b/cmd/chain-maind/app/app.go @@ -9,7 +9,6 @@ import ( "time" clientcfg "github.com/cosmos/cosmos-sdk/client/config" - conf "github.com/cosmos/cosmos-sdk/client/config" "github.com/cosmos/cosmos-sdk/crypto/keyring" serverconfig "github.com/cosmos/cosmos-sdk/server/config" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" @@ -85,7 +84,7 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) { if err != nil { return err } - initClientCtx, err = conf.ReadFromClientConfig(initClientCtx) + initClientCtx, err = clientcfg.ReadFromClientConfig(initClientCtx) if err != nil { return err } diff --git a/x/icaauth/keeper/keeper.go b/x/icaauth/keeper/keeper.go index 27f74642e..ddf24748c 100644 --- a/x/icaauth/keeper/keeper.go +++ b/x/icaauth/keeper/keeper.go @@ -9,7 +9,6 @@ import ( "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - "github.com/cosmos/gogoproto/proto" capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" icacontrollerkeeper "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/keeper" @@ -62,11 +61,7 @@ func (k *Keeper) DoSubmitTx(ctx sdk.Context, connectionID, owner string, msgs [] return err } - protoMsgs := make([]proto.Message, len(msgs)) - for i, msg := range msgs { - protoMsgs[i] = msg.(proto.Message) - } - data, err := icatypes.SerializeCosmosTx(k.cdc, protoMsgs, icatypes.EncodingProtobuf) + data, err := icatypes.SerializeCosmosTx(k.cdc, msgs, icatypes.EncodingProtobuf) if err != nil { return err } diff --git a/x/nft-transfer/types/codec.go b/x/nft-transfer/types/codec.go index 1202fbadc..ed5300571 100644 --- a/x/nft-transfer/types/codec.go +++ b/x/nft-transfer/types/codec.go @@ -8,7 +8,7 @@ import ( ) var ( - amino = codec.NewLegacyAmino() + AminoCdc = codec.NewLegacyAmino() // ModuleCdc references the global x/ibc-transfer module codec. Note, the codec // should ONLY be used in certain instances of tests and for JSON encoding. @@ -16,9 +16,6 @@ var ( // The actual codec used for serialization should be provided to x/ibc transfer and // defined at the application level. ModuleCdc = codec.NewProtoCodec(codectypes.NewInterfaceRegistry()) - - // AminoCdc is a amino codec created to support amino json compatible msgs. - AminoCdc = codec.NewAminoCodec(amino) ) // RegisterLegacyAminoCodec registers the necessary nft-transfer interfaces and concrete types diff --git a/x/nft/types/codec.go b/x/nft/types/codec.go index bcfbe90c7..39758f425 100644 --- a/x/nft/types/codec.go +++ b/x/nft/types/codec.go @@ -17,14 +17,13 @@ import ( ) var ( - amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewAminoCodec(amino) + ModuleCdc = codec.NewLegacyAmino() ) func init() { - RegisterLegacyAminoCodec(amino) - cryptocodec.RegisterCrypto(amino) - amino.Seal() + RegisterLegacyAminoCodec(ModuleCdc) + cryptocodec.RegisterCrypto(ModuleCdc) + ModuleCdc.Seal() } // RegisterLegacyAminoCodec concrete types on codec