From d458cab1a87830cc5f96d3efb1fe875a18cb04eb Mon Sep 17 00:00:00 2001 From: Youngtaek Yoon Date: Wed, 27 Mar 2024 09:18:14 +0000 Subject: [PATCH] Lint --- .golangci.yml | 13 +++- app/ante.go | 8 +-- app/app.go | 63 +++++++++---------- app/app_test.go | 2 + app/encoding.go | 3 +- app/export.go | 4 +- app/test_helpers.go | 1 - app/test_support.go | 6 +- app/upgrades.go | 8 +-- app/upgrades/noop/upgrades.go | 4 +- app/upgrades/types.go | 6 +- app/upgrades/v050/upgrades.go | 4 +- cmd/fnsad/commands.go | 7 +-- cmd/fnsad/main.go | 4 +- cmd/fnsad/root.go | 17 ++++-- cmd/fnsad/testnet.go | 111 ++++++++++++++++++++++++++-------- 16 files changed, 169 insertions(+), 92 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index f2913eb6..c7c0f7ee 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -2,9 +2,9 @@ linters: enable: - bodyclose - deadcode - - depguard - dogsled - errcheck + - gci - goconst - gocritic - gofmt @@ -68,6 +68,17 @@ linters-settings: # Default is to use a neutral variety of English. # Setting locale to US will correct the British spelling of 'colour' to 'color'. locale: US + gci: + custom-order: true + sections: + - standard # Standard section: captures all standard packages. + - default # Default section: contains all imports that could not be matched to another section type. + - prefix(cosmossdk.io) + - prefix(github.com/cosmos/cosmos-sdk) + - prefix(github.com/cosmos/ibc-go) + - prefix(github.com/CosmWasm/wasmd) + - prefix(github.com/Finschia/finschia-sdk) + run: # default concurrency is a available CPU number concurrency: 4 diff --git a/app/ante.go b/app/ante.go index 7b20ec60..a2c601f3 100644 --- a/app/ante.go +++ b/app/ante.go @@ -3,16 +3,16 @@ package app import ( "errors" - circuitante "cosmossdk.io/x/circuit/ante" - ibcante "github.com/cosmos/ibc-go/v8/modules/core/ante" - "github.com/cosmos/ibc-go/v8/modules/core/keeper" - corestoretypes "cosmossdk.io/core/store" + circuitante "cosmossdk.io/x/circuit/ante" circuitkeeper "cosmossdk.io/x/circuit/keeper" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth/ante" + ibcante "github.com/cosmos/ibc-go/v8/modules/core/ante" + "github.com/cosmos/ibc-go/v8/modules/core/keeper" + wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" wasmTypes "github.com/CosmWasm/wasmd/x/wasm/types" ) diff --git a/app/app.go b/app/app.go index 1d06b4d4..0335d3ed 100644 --- a/app/app.go +++ b/app/app.go @@ -13,33 +13,7 @@ import ( abci "github.com/cometbft/cometbft/abci/types" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" dbm "github.com/cosmos/cosmos-db" - govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" - paramproposal "github.com/cosmos/cosmos-sdk/x/params/types/proposal" "github.com/cosmos/gogoproto/proto" - "github.com/cosmos/ibc-go/modules/capability" - capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" - ica "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts" - icacontroller "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller" - icacontrollerkeeper "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/keeper" - icacontrollertypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types" - icahost "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host" - icahostkeeper "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/keeper" - icahosttypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/types" - icatypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types" - ibcfee "github.com/cosmos/ibc-go/v8/modules/apps/29-fee" - ibcfeekeeper "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/keeper" - ibcfeetypes "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types" - "github.com/cosmos/ibc-go/v8/modules/apps/transfer" - ibctransferkeeper "github.com/cosmos/ibc-go/v8/modules/apps/transfer/keeper" - ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" - ibc "github.com/cosmos/ibc-go/v8/modules/core" - ibcclienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" //nolint:staticcheck - ibcconnectiontypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types" - porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types" - ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" - ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" - ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" "github.com/spf13/cast" autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" @@ -114,6 +88,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/gov" govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" "github.com/cosmos/cosmos-sdk/x/group" groupkeeper "github.com/cosmos/cosmos-sdk/x/group/keeper" groupmodule "github.com/cosmos/cosmos-sdk/x/group/module" @@ -123,6 +98,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/params" paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" + paramproposal "github.com/cosmos/cosmos-sdk/x/params/types/proposal" "github.com/cosmos/cosmos-sdk/x/slashing" slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" @@ -130,6 +106,31 @@ import ( stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + "github.com/cosmos/ibc-go/modules/capability" + capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + ica "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts" + icacontroller "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller" + icacontrollerkeeper "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/keeper" + icacontrollertypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types" + icahost "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host" + icahostkeeper "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/keeper" + icahosttypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/types" + icatypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types" + ibcfee "github.com/cosmos/ibc-go/v8/modules/apps/29-fee" + ibcfeekeeper "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/keeper" + ibcfeetypes "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types" + "github.com/cosmos/ibc-go/v8/modules/apps/transfer" + ibctransferkeeper "github.com/cosmos/ibc-go/v8/modules/apps/transfer/keeper" + ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" + ibc "github.com/cosmos/ibc-go/v8/modules/core" + ibcclienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" //nolint:staticcheck + ibcconnectiontypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types" + porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types" + ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" + ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" + ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" + "github.com/CosmWasm/wasmd/x/wasm" wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" @@ -1027,8 +1028,8 @@ func (app *FnsaApp) EndBlocker(ctx sdk.Context) (sdk.EndBlock, error) { return app.ModuleManager.EndBlock(ctx) } -func (a *FnsaApp) Configurator() module.Configurator { - return a.configurator +func (app *FnsaApp) Configurator() module.Configurator { + return app.configurator } // InitChainer application update at chain initialization @@ -1098,8 +1099,8 @@ func (app *FnsaApp) AutoCliOpts() autocli.AppOptions { } // DefaultGenesis returns a default genesis from the registered AppModuleBasic's. -func (a *FnsaApp) DefaultGenesis() map[string]json.RawMessage { - return a.BasicModuleManager.DefaultGenesis(a.appCodec) +func (app *FnsaApp) DefaultGenesis() map[string]json.RawMessage { + return app.BasicModuleManager.DefaultGenesis(app.appCodec) } // GetKey returns the KVStoreKey for the provided store key. @@ -1211,7 +1212,7 @@ func BlockedAddresses() map[string]bool { // allow the following addresses to receive funds // TODO: uncomment it when authority is ready - //delete(modAccAddrs, authtypes.NewModuleAddress(govtypes.ModuleName).String()) + // delete(modAccAddrs, authtypes.NewModuleAddress(govtypes.ModuleName).String()) return modAccAddrs } diff --git a/app/app_test.go b/app/app_test.go index e0b57d37..7d5654a6 100644 --- a/app/app_test.go +++ b/app/app_test.go @@ -48,6 +48,8 @@ func TestBlockedAddrs(t *testing.T) { gapp := Setup(t) for acc := range BlockedAddresses() { + acc := acc + t.Run(acc, func(t *testing.T) { var addr sdk.AccAddress if modAddr, err := sdk.AccAddressFromBech32(acc); err == nil { diff --git a/app/encoding.go b/app/encoding.go index 41059b62..6de391c6 100644 --- a/app/encoding.go +++ b/app/encoding.go @@ -3,6 +3,7 @@ package app import ( "testing" + "github.com/Finschia/finschia/v3/app/params" dbm "github.com/cosmos/cosmos-db" "cosmossdk.io/log" @@ -10,8 +11,6 @@ import ( simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" - - "github.com/Finschia/finschia/v3/app/params" ) // MakeEncodingConfig creates a new EncodingConfig with all modules registered. For testing only diff --git a/app/export.go b/app/export.go index 4406ea56..dcf21875 100644 --- a/app/export.go +++ b/app/export.go @@ -82,7 +82,9 @@ func (app *FnsaApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [ if err != nil { panic(err) } - _, _ = app.DistrKeeper.WithdrawValidatorCommission(ctx, valBz) + if _, err := app.DistrKeeper.WithdrawValidatorCommission(ctx, valBz); err != nil { + panic(err) + } return false }) if err != nil { diff --git a/app/test_helpers.go b/app/test_helpers.go index 18afe864..4685c93d 100644 --- a/app/test_helpers.go +++ b/app/test_helpers.go @@ -358,7 +358,6 @@ func GenesisStateWithValSet( } validators = append(validators, validator) delegations = append(delegations, stakingtypes.NewDelegation(genAccs[0].GetAddress().String(), sdk.ValAddress(val.Address).String(), sdkmath.LegacyOneDec())) - } // set validators and delegations diff --git a/app/test_support.go b/app/test_support.go index 20d433bb..243e6c0c 100644 --- a/app/test_support.go +++ b/app/test_support.go @@ -1,14 +1,14 @@ package app import ( - capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" - ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" - "github.com/cosmos/cosmos-sdk/baseapp" authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" + capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" + ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" + wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" ) diff --git a/app/upgrades.go b/app/upgrades.go index 17ecb2e8..28dfd98a 100644 --- a/app/upgrades.go +++ b/app/upgrades.go @@ -3,6 +3,10 @@ package app import ( "fmt" + "github.com/Finschia/finschia/v3/app/upgrades" + "github.com/Finschia/finschia/v3/app/upgrades/noop" + v050 "github.com/Finschia/finschia/v3/app/upgrades/v050" + upgradetypes "cosmossdk.io/x/upgrade/types" "github.com/cosmos/cosmos-sdk/baseapp" @@ -20,10 +24,6 @@ import ( v2 "github.com/CosmWasm/wasmd/x/wasm/migrations/v2" wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" - - "github.com/Finschia/finschia/v3/app/upgrades" - "github.com/Finschia/finschia/v3/app/upgrades/noop" - v050 "github.com/Finschia/finschia/v3/app/upgrades/v050" ) // Upgrades list of chain upgrades diff --git a/app/upgrades/noop/upgrades.go b/app/upgrades/noop/upgrades.go index e6090419..f78e0a88 100644 --- a/app/upgrades/noop/upgrades.go +++ b/app/upgrades/noop/upgrades.go @@ -3,12 +3,12 @@ package noop import ( "context" + "github.com/Finschia/finschia/v3/app/upgrades" + storetypes "cosmossdk.io/store/types" upgradetypes "cosmossdk.io/x/upgrade/types" "github.com/cosmos/cosmos-sdk/types/module" - - "github.com/Finschia/finschia/v3/app/upgrades" ) // NewUpgrade constructor diff --git a/app/upgrades/types.go b/app/upgrades/types.go index 2ff71ce6..90448952 100644 --- a/app/upgrades/types.go +++ b/app/upgrades/types.go @@ -3,9 +3,6 @@ package upgrades import ( "context" - capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" - ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" - storetypes "cosmossdk.io/store/types" upgradetypes "cosmossdk.io/x/upgrade/types" @@ -14,6 +11,9 @@ import ( authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" consensusparamkeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper" paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" + + capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" + ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" ) type AppKeepers struct { diff --git a/app/upgrades/v050/upgrades.go b/app/upgrades/v050/upgrades.go index 959b8472..2fe15872 100644 --- a/app/upgrades/v050/upgrades.go +++ b/app/upgrades/v050/upgrades.go @@ -3,13 +3,13 @@ package v050 import ( "context" + "github.com/Finschia/finschia/v3/app/upgrades" + storetypes "cosmossdk.io/store/types" circuittypes "cosmossdk.io/x/circuit/types" upgradetypes "cosmossdk.io/x/upgrade/types" "github.com/cosmos/cosmos-sdk/types/module" - - "github.com/Finschia/finschia/v3/app/upgrades" ) // UpgradeName defines the on-chain upgrade name diff --git a/cmd/fnsad/commands.go b/cmd/fnsad/commands.go index 18146734..58b8dffa 100644 --- a/cmd/fnsad/commands.go +++ b/cmd/fnsad/commands.go @@ -5,6 +5,9 @@ import ( "io" "os" + "github.com/Finschia/finschia/v3/app" + cmtcfg "github.com/cometbft/cometbft/config" + dbm "github.com/cosmos/cosmos-db" "github.com/prometheus/client_golang/prometheus" "github.com/spf13/cast" "github.com/spf13/cobra" @@ -12,8 +15,6 @@ import ( "cosmossdk.io/log" confixcmd "cosmossdk.io/tools/confix/cmd" - cmtcfg "github.com/cometbft/cometbft/config" - dbm "github.com/cosmos/cosmos-db" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/debug" @@ -38,8 +39,6 @@ import ( wasmcli "github.com/CosmWasm/wasmd/x/wasm/client/cli" wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" - - "github.com/Finschia/finschia/v3/app" ) // initCometBFTConfig helps to override default CometBFT Config values. diff --git a/cmd/fnsad/main.go b/cmd/fnsad/main.go index 4e995758..71e33623 100644 --- a/cmd/fnsad/main.go +++ b/cmd/fnsad/main.go @@ -3,11 +3,11 @@ package main import ( "os" + "github.com/Finschia/finschia/v3/app" + "cosmossdk.io/log" svrcmd "github.com/cosmos/cosmos-sdk/server/cmd" - - "github.com/Finschia/finschia/v3/app" ) func main() { diff --git a/cmd/fnsad/root.go b/cmd/fnsad/root.go index 5cdd5e24..9a972124 100644 --- a/cmd/fnsad/root.go +++ b/cmd/fnsad/root.go @@ -3,6 +3,8 @@ package main import ( "os" + "github.com/Finschia/finschia/v3/app" + "github.com/Finschia/finschia/v3/app/params" dbm "github.com/cosmos/cosmos-db" "github.com/spf13/cobra" @@ -22,9 +24,6 @@ import ( wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" - - "github.com/Finschia/finschia/v3/app" - "github.com/Finschia/finschia/v3/app/params" ) // NewRootCmd creates a new root command for wasmd. It is called once in the @@ -81,7 +80,7 @@ func NewRootCmd() *cobra.Command { // sets the RPC client needed for SIGN_MODE_TEXTUAL. This sign mode // is only available if the client is online. if !initClientCtx.Offline { - enabledSignModes := append(tx.DefaultSignModes, signing.SignMode_SIGN_MODE_TEXTUAL) + enabledSignModes := append(append([]signing.SignMode{}, tx.DefaultSignModes...), signing.SignMode_SIGN_MODE_TEXTUAL) txConfigOpts := tx.ConfigOptions{ EnabledSignModes: enabledSignModes, TextualCoinMetadataQueryFn: txmodule.NewGRPCCoinMetadataQueryFn(initClientCtx), @@ -112,8 +111,14 @@ func NewRootCmd() *cobra.Command { // add keyring to autocli opts autoCliOpts := tempApp.AutoCliOpts() - initClientCtx, _ = config.ReadFromClientConfig(initClientCtx) - autoCliOpts.Keyring, _ = keyring.NewAutoCLIKeyring(initClientCtx.Keyring) + initClientCtx, err := config.ReadFromClientConfig(initClientCtx) + if err != nil { + panic(err) + } + autoCliOpts.Keyring, err = keyring.NewAutoCLIKeyring(initClientCtx.Keyring) + if err != nil { + panic(err) + } autoCliOpts.ClientCtx = initClientCtx if err := autoCliOpts.EnhanceRootCommand(rootCmd); err != nil { diff --git a/cmd/fnsad/testnet.go b/cmd/fnsad/testnet.go index b4c15b1d..dead7bd8 100644 --- a/cmd/fnsad/testnet.go +++ b/cmd/fnsad/testnet.go @@ -11,11 +11,11 @@ import ( "path/filepath" "time" - "github.com/spf13/cobra" - "github.com/spf13/pflag" - + "github.com/Finschia/finschia/v3/app" cmtconfig "github.com/cometbft/cometbft/config" cmttime "github.com/cometbft/cometbft/types/time" + "github.com/spf13/cobra" + "github.com/spf13/pflag" "cosmossdk.io/math" "cosmossdk.io/math/unsafe" @@ -39,8 +39,6 @@ import ( "github.com/cosmos/cosmos-sdk/x/genutil" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - - "github.com/Finschia/finschia/v3/app" ) var ( @@ -146,17 +144,47 @@ Example: config := serverCtx.Config args := initArgs{} - args.outputDir, _ = cmd.Flags().GetString(flagOutputDir) - args.keyringBackend, _ = cmd.Flags().GetString(flags.FlagKeyringBackend) - args.chainID, _ = cmd.Flags().GetString(flags.FlagChainID) - args.minGasPrices, _ = cmd.Flags().GetString(server.FlagMinGasPrices) - args.nodeDirPrefix, _ = cmd.Flags().GetString(flagNodeDirPrefix) - args.nodeDaemonHome, _ = cmd.Flags().GetString(flagNodeDaemonHome) - args.startingIPAddress, _ = cmd.Flags().GetString(flagStartingIPAddress) - args.numValidators, _ = cmd.Flags().GetInt(flagNumValidators) - args.algo, _ = cmd.Flags().GetString(flags.FlagKeyType) - - args.singleMachine, _ = cmd.Flags().GetBool(flagSingleHost) + args.outputDir, err = cmd.Flags().GetString(flagOutputDir) + if err != nil { + return err + } + args.keyringBackend, err = cmd.Flags().GetString(flags.FlagKeyringBackend) + if err != nil { + return err + } + args.chainID, err = cmd.Flags().GetString(flags.FlagChainID) + if err != nil { + return err + } + args.minGasPrices, err = cmd.Flags().GetString(server.FlagMinGasPrices) + if err != nil { + return err + } + args.nodeDirPrefix, err = cmd.Flags().GetString(flagNodeDirPrefix) + if err != nil { + return err + } + args.nodeDaemonHome, err = cmd.Flags().GetString(flagNodeDaemonHome) + if err != nil { + return err + } + args.startingIPAddress, err = cmd.Flags().GetString(flagStartingIPAddress) + if err != nil { + return err + } + args.numValidators, err = cmd.Flags().GetInt(flagNumValidators) + if err != nil { + return err + } + args.algo, err = cmd.Flags().GetString(flags.FlagKeyType) + if err != nil { + return err + } + + args.singleMachine, err = cmd.Flags().GetBool(flagSingleHost) + if err != nil { + return err + } config.Consensus.TimeoutCommit, err = cmd.Flags().GetDuration(flagCommitTimeout) if err != nil { return err @@ -190,16 +218,47 @@ Example: `, version.AppName), RunE: func(cmd *cobra.Command, _ []string) error { args := startArgs{} - args.outputDir, _ = cmd.Flags().GetString(flagOutputDir) - args.chainID, _ = cmd.Flags().GetString(flags.FlagChainID) - args.minGasPrices, _ = cmd.Flags().GetString(server.FlagMinGasPrices) - args.numValidators, _ = cmd.Flags().GetInt(flagNumValidators) - args.algo, _ = cmd.Flags().GetString(flags.FlagKeyType) - args.enableLogging, _ = cmd.Flags().GetBool(flagEnableLogging) - args.rpcAddress, _ = cmd.Flags().GetString(flagRPCAddress) - args.apiAddress, _ = cmd.Flags().GetString(flagAPIAddress) - args.grpcAddress, _ = cmd.Flags().GetString(flagGRPCAddress) - args.printMnemonic, _ = cmd.Flags().GetBool(flagPrintMnemonic) + var err error + args.outputDir, err = cmd.Flags().GetString(flagOutputDir) + if err != nil { + return err + } + args.chainID, err = cmd.Flags().GetString(flags.FlagChainID) + if err != nil { + return err + } + args.minGasPrices, err = cmd.Flags().GetString(server.FlagMinGasPrices) + if err != nil { + return err + } + args.numValidators, err = cmd.Flags().GetInt(flagNumValidators) + if err != nil { + return err + } + args.algo, err = cmd.Flags().GetString(flags.FlagKeyType) + if err != nil { + return err + } + args.enableLogging, err = cmd.Flags().GetBool(flagEnableLogging) + if err != nil { + return err + } + args.rpcAddress, err = cmd.Flags().GetString(flagRPCAddress) + if err != nil { + return err + } + args.apiAddress, err = cmd.Flags().GetString(flagAPIAddress) + if err != nil { + return err + } + args.grpcAddress, err = cmd.Flags().GetString(flagGRPCAddress) + if err != nil { + return err + } + args.printMnemonic, err = cmd.Flags().GetBool(flagPrintMnemonic) + if err != nil { + return err + } return startTestnet(cmd, args) },