Skip to content

Commit

Permalink
fumpt (#1581)
Browse files Browse the repository at this point in the history
* fumpt

* remove gitpod
  • Loading branch information
faddat authored Jul 11, 2022
1 parent bc15e65 commit 198fc5b
Show file tree
Hide file tree
Showing 13 changed files with 18 additions and 35 deletions.
2 changes: 1 addition & 1 deletion ante/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion ante/fee.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 0 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@ func NewGaiaApp(
appOpts servertypes.AppOptions,
baseAppOptions ...func(*baseapp.BaseApp),
) *GaiaApp {

appCodec := encodingConfig.Codec
legacyAmino := encodingConfig.Amino
interfaceRegistry := encodingConfig.InterfaceRegistry
Expand Down Expand Up @@ -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{}
Expand Down
3 changes: 0 additions & 3 deletions cmd/gaiad/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -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")
Expand Down
9 changes: 3 additions & 6 deletions cmd/gaiad/cmd/testnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ Example:
return cmd
}

const nodeDirPerm = 0755
const nodeDirPerm = 0o755

// Initialize the testnet
func InitTestnet(
Expand All @@ -119,7 +119,6 @@ func InitTestnet(
algoStr string,
numValidators int,
) error {

if chainID == "" {
chainID = "chain-" + tmrand.Str(6)
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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
}
Expand Down
1 change: 1 addition & 0 deletions contrib/generate_release_note/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build exclude
// +build exclude

package main
Expand Down
3 changes: 0 additions & 3 deletions tests/e2e/e2e_cli_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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
Expand Down
9 changes: 5 additions & 4 deletions tests/e2e/e2e_setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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"),
Expand Down
9 changes: 3 additions & 6 deletions tests/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -149,7 +147,6 @@ func (s *IntegrationTestSuite) TestSendTokensFromNewGovAccount() {
15*time.Second,
5*time.Second,
)

}

func (s *IntegrationTestSuite) TestGovSoftwareUpgrade() {
Expand Down
3 changes: 0 additions & 3 deletions tests/e2e/e2e_util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/io.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
2 changes: 0 additions & 2 deletions tests/e2e/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
6 changes: 3 additions & 3 deletions tests/e2e/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit 198fc5b

Please sign in to comment.