diff --git a/ante/ante.go b/ante/ante.go index 98c8139016f..b544354c687 100644 --- a/ante/ante.go +++ b/ante/ante.go @@ -31,7 +31,7 @@ func NewAnteHandler(opts HandlerOptions) (sdk.AnteHandler, error) { return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "IBC keeper is required for middlewares") } - var sigGasConsumer = opts.SigGasConsumer + sigGasConsumer := opts.SigGasConsumer if sigGasConsumer == nil { sigGasConsumer = ante.DefaultSigVerificationGasConsumer } diff --git a/ante/fee.go b/ante/fee.go index aa7b709049c..c3dbf15063b 100644 --- a/ante/fee.go +++ b/ante/fee.go @@ -76,7 +76,7 @@ func (mfd BypassMinFeeDecorator) bypassMinFeeMsgs(msgs []sdk.Msg) bool { return true } -//utils function: GetTxPriority +// utils function: GetTxPriority // getTxPriority returns a naive tx priority based on the amount of the smallest denomination of the fee // provided in a transaction. func GetTxPriority(fee sdk.Coins) int64 { diff --git a/app/app.go b/app/app.go index a352c86185c..26714a6e8ae 100644 --- a/app/app.go +++ b/app/app.go @@ -257,7 +257,6 @@ func NewGaiaApp( appOpts servertypes.AppOptions, baseAppOptions ...func(*baseapp.BaseApp), ) *GaiaApp { - appCodec := encodingConfig.Codec legacyAmino := encodingConfig.Amino interfaceRegistry := encodingConfig.InterfaceRegistry @@ -721,7 +720,6 @@ func NewGaiaApp( app.UpgradeKeeper.SetUpgradeHandler( upgradeName, func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { - fromVM[icatypes.ModuleName] = icaModule.ConsensusVersion() // create ICS27 Controller submodule params controllerParams := icacontrollertypes.Params{} diff --git a/cmd/gaiad/cmd/root.go b/cmd/gaiad/cmd/root.go index 79e94d17e49..bbbcb48cbe5 100644 --- a/cmd/gaiad/cmd/root.go +++ b/cmd/gaiad/cmd/root.go @@ -135,7 +135,6 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) { ) rootCmd.AddCommand(server.RosettaCommand(encodingConfig.InterfaceRegistry, encodingConfig.Codec)) - } func addModuleInitFlags(startCmd *cobra.Command) { @@ -204,7 +203,6 @@ func (ac appCreator) newApp( traceStore io.Writer, appOpts servertypes.AppOptions, ) servertypes.Application { - var cache sdk.MultiStorePersistentCache if cast.ToBool(appOpts.Get(server.FlagInterBlockCache)) { @@ -262,7 +260,6 @@ func (ac appCreator) appExport( jailAllowedAddrs []string, appOpts servertypes.AppOptions, ) (servertypes.ExportedApp, error) { - homePath, ok := appOpts.Get(flags.FlagHome).(string) if !ok || homePath == "" { return servertypes.ExportedApp{}, errors.New("application home is not set") diff --git a/cmd/gaiad/cmd/testnet.go b/cmd/gaiad/cmd/testnet.go index 01d0b7419e5..dc12e2e3095 100644 --- a/cmd/gaiad/cmd/testnet.go +++ b/cmd/gaiad/cmd/testnet.go @@ -100,7 +100,7 @@ Example: return cmd } -const nodeDirPerm = 0755 +const nodeDirPerm = 0o755 // Initialize the testnet func InitTestnet( @@ -119,7 +119,6 @@ func InitTestnet( algoStr string, numValidators int, ) error { - if chainID == "" { chainID = "chain-" + tmrand.Str(6) } @@ -283,7 +282,6 @@ func initGenFiles( genAccounts []authtypes.GenesisAccount, genBalances []banktypes.Balance, genFiles []string, numValidators int, ) error { - appGenState := mbm.DefaultGenesis(clientCtx.Codec) // set the accounts in the genesis state @@ -332,7 +330,6 @@ func collectGenFiles( nodeIDs []string, valPubKeys []cryptotypes.PubKey, numValidators int, outputDir, nodeDirPrefix, nodeDaemonHome string, genBalIterator banktypes.GenesisBalancesIterator, ) error { - var appState json.RawMessage genTime := tmtime.Now() @@ -400,12 +397,12 @@ func calculateIP(ip string, i int) (string, error) { func writeFile(name string, dir string, contents []byte) error { file := filepath.Join(dir, name) - err := tmos.EnsureDir(dir, 0755) + err := tmos.EnsureDir(dir, 0o755) if err != nil { return err } - err = ioutil.WriteFile(file, contents, 0600) + err = ioutil.WriteFile(file, contents, 0o600) if err != nil { return err } diff --git a/contrib/generate_release_note/main.go b/contrib/generate_release_note/main.go index 6f41a1e397c..31bfce94502 100644 --- a/contrib/generate_release_note/main.go +++ b/contrib/generate_release_note/main.go @@ -1,3 +1,4 @@ +//go:build exclude // +build exclude package main diff --git a/tests/e2e/e2e_cli_util.go b/tests/e2e/e2e_cli_util.go index a3232ea05e6..f66ec9dfadd 100644 --- a/tests/e2e/e2e_cli_util.go +++ b/tests/e2e/e2e_cli_util.go @@ -14,7 +14,6 @@ import ( func queryGaiaTx(endpoint, txHash string) error { resp, err := http.Get(fmt.Sprintf("%s/cosmos/tx/v1beta1/txs/%s", endpoint, txHash)) - if err != nil { return fmt.Errorf("failed to execute HTTP request: %w", err) } @@ -111,9 +110,7 @@ func queryGovProposal(endpoint string, proposalId int) (govv1beta1.QueryProposal defer resp.Body.Close() body, err := io.ReadAll(resp.Body) - if err != nil { - return emptyProp, err } var govProposalResp govv1beta1.QueryProposalResponse diff --git a/tests/e2e/e2e_setup_test.go b/tests/e2e/e2e_setup_test.go index a746fb3ef1f..ec5a8af9501 100644 --- a/tests/e2e/e2e_setup_test.go +++ b/tests/e2e/e2e_setup_test.go @@ -5,9 +5,6 @@ import ( b64 "encoding/base64" "encoding/json" "fmt" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" "io" "io/ioutil" "net/http" @@ -19,6 +16,10 @@ import ( "testing" "time" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/server" srvconfig "github.com/cosmos/cosmos-sdk/server/config" sdk "github.com/cosmos/cosmos-sdk/types" @@ -370,7 +371,7 @@ func (s *IntegrationTestSuite) runIBCRelayer() { gaiaBVal := s.chainB.validators[0] hermesCfgPath := path.Join(tmpDir, "hermes") - s.Require().NoError(os.MkdirAll(hermesCfgPath, 0755)) + s.Require().NoError(os.MkdirAll(hermesCfgPath, 0o755)) _, err = copyFile( filepath.Join("./scripts/", "hermes_bootstrap.sh"), filepath.Join(hermesCfgPath, "hermes_bootstrap.sh"), diff --git a/tests/e2e/e2e_test.go b/tests/e2e/e2e_test.go index d4fd41c49ac..d6ca411e34a 100644 --- a/tests/e2e/e2e_test.go +++ b/tests/e2e/e2e_test.go @@ -2,10 +2,11 @@ package e2e import ( "fmt" - "github.com/ory/dockertest/v3/docker" "strings" "time" + "github.com/ory/dockertest/v3/docker" + sdk "github.com/cosmos/cosmos-sdk/types" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) @@ -16,7 +17,6 @@ func (s *IntegrationTestSuite) TestIBCTokenTransfer() { var ibcStakeDenom string s.Run("send_photon_to_chainB", func() { - // require the recipient account receives the IBC tokens (IBC packets ACKd) var ( balances sdk.Coins @@ -55,9 +55,7 @@ func (s *IntegrationTestSuite) TestIBCTokenTransfer() { func (s *IntegrationTestSuite) TestBankTokenTransfer() { s.Run("send_photon_between_accounts", func() { - var ( - err error - ) + var err error senderAddress, err := s.chainA.validators[0].keyInfo.GetAddress() s.Require().NoError(err) @@ -149,7 +147,6 @@ func (s *IntegrationTestSuite) TestSendTokensFromNewGovAccount() { 15*time.Second, 5*time.Second, ) - } func (s *IntegrationTestSuite) TestGovSoftwareUpgrade() { diff --git a/tests/e2e/e2e_util_test.go b/tests/e2e/e2e_util_test.go index 9a183f95ed0..e119fe788ab 100644 --- a/tests/e2e/e2e_util_test.go +++ b/tests/e2e/e2e_util_test.go @@ -371,7 +371,6 @@ func (s *IntegrationTestSuite) queryGovProposal(endpoint string, proposalId uint path := fmt.Sprintf("%s/cosmos/gov/v1beta1/proposals/%d", endpoint, proposalId) resp, err := http.Get(path) - if err != nil { s.T().Logf("This is the err: %s", err.Error()) } @@ -382,12 +381,10 @@ func (s *IntegrationTestSuite) queryGovProposal(endpoint string, proposalId uint defer resp.Body.Close() body, err := io.ReadAll(resp.Body) - if err != nil { s.T().Logf("This is the err: %s", err.Error()) } if err != nil { - return emptyProp, err } s.T().Logf("This is the body: %s", body) diff --git a/tests/e2e/io.go b/tests/e2e/io.go index a4f6c6edb37..946d5e8c449 100644 --- a/tests/e2e/io.go +++ b/tests/e2e/io.go @@ -39,5 +39,5 @@ func writeFile(path string, body []byte) error { return err } - return ioutil.WriteFile(path, body, 0644) + return ioutil.WriteFile(path, body, 0o644) } diff --git a/tests/e2e/keys.go b/tests/e2e/keys.go index 250c561d025..5e62599fffd 100644 --- a/tests/e2e/keys.go +++ b/tests/e2e/keys.go @@ -37,9 +37,7 @@ func createMemoryKey() (mnemonic string, info *keyring.Record, err error) { } func createMemoryKeyFromMnemonic(mnemonic string) (*keyring.Record, error) { - kb, err := keyring.New("testnet", keyring.BackendMemory, "", nil, cdc) - if err != nil { return nil, err } diff --git a/tests/e2e/validator.go b/tests/e2e/validator.go index bc4c62d7165..925242bf82e 100644 --- a/tests/e2e/validator.go +++ b/tests/e2e/validator.go @@ -49,7 +49,7 @@ func (v *validator) configDir() string { func (v *validator) createConfig() error { p := path.Join(v.configDir(), "config") - return os.MkdirAll(p, 0755) + return os.MkdirAll(p, 0o755) } func (v *validator) init() error { @@ -112,12 +112,12 @@ func (v *validator) createConsensusKey() error { config.Moniker = v.moniker pvKeyFile := config.PrivValidator.KeyFile() - if err := tmos.EnsureDir(filepath.Dir(pvKeyFile), 0777); err != nil { + if err := tmos.EnsureDir(filepath.Dir(pvKeyFile), 0o777); err != nil { return err } pvStateFile := config.PrivValidator.StateFile() - if err := tmos.EnsureDir(filepath.Dir(pvStateFile), 0777); err != nil { + if err := tmos.EnsureDir(filepath.Dir(pvStateFile), 0o777); err != nil { return err }