From bba2d4e8a0dee229f0a2ccf093435c07c0c46fde Mon Sep 17 00:00:00 2001 From: Dheeraj Dubey Date: Tue, 9 May 2023 17:57:29 +0530 Subject: [PATCH] replace if else with switch --- .golangci.yml | 2 +- app/app.go | 8 +++++--- app/upgrades/testnet/v10/upgrades.go | 1 - cmd/comdex/root.go | 2 +- x/asset/client/cli/tx.go | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 9b4f0e623..737df1eaa 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -21,7 +21,7 @@ linters: - ineffassign - misspell - revive - - nakedret + #- nakedret - nolintlint - rowserrcheck - staticcheck diff --git a/app/app.go b/app/app.go index 9f8140ebe..951c5f370 100644 --- a/app/app.go +++ b/app/app.go @@ -177,8 +177,8 @@ import ( cwasm "github.com/comdex-official/comdex/app/wasm" - tv11 "github.com/comdex-official/comdex/app/upgrades/testnet/v11" mv11 "github.com/comdex-official/comdex/app/upgrades/mainnet/v11" + tv11 "github.com/comdex-official/comdex/app/upgrades/testnet/v11" ) const ( @@ -1350,12 +1350,14 @@ func (a *App) registerUpgradeHandlers() { if err != nil { panic(err) } - if upgradeInfo.Name == tv11.UpgradeName { + + switch { + case upgradeInfo.Name == tv11.UpgradeName: a.UpgradeKeeper.SetUpgradeHandler( tv11.UpgradeName, tv11.CreateUpgradeHandlerV11(a.mm, a.configurator), ) - } else if upgradeInfo.Name == mv11.UpgradeName { + case upgradeInfo.Name == mv11.UpgradeName: a.UpgradeKeeper.SetUpgradeHandler( mv11.UpgradeName, mv11.CreateUpgradeHandlerV11(a.mm, a.configurator, a.LiquidityKeeper, a.AssetKeeper, a.BankKeeper, a.AccountKeeper, a.Rewardskeeper, a.ICAHostKeeper), diff --git a/app/upgrades/testnet/v10/upgrades.go b/app/upgrades/testnet/v10/upgrades.go index 0af57db0b..6a2db6e3f 100644 --- a/app/upgrades/testnet/v10/upgrades.go +++ b/app/upgrades/testnet/v10/upgrades.go @@ -12,7 +12,6 @@ func CreateUpgradeHandlerV10( ) upgradetypes.UpgradeHandler { return func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { vm, err := mm.RunMigrations(ctx, configurator, fromVM) - if err != nil { return vm, err } diff --git a/cmd/comdex/root.go b/cmd/comdex/root.go index 13adad1c0..78592aa06 100644 --- a/cmd/comdex/root.go +++ b/cmd/comdex/root.go @@ -83,7 +83,7 @@ func initRootCmd(rootCmd *cobra.Command, encoding comdex.EncodingConfig) { genutilcli.GenTxCmd(comdex.ModuleBasics, encoding.TxConfig, banktypes.GenesisBalancesIterator{}, comdex.DefaultNodeHome), genutilcli.ValidateGenesisCmd(comdex.ModuleBasics), AddGenesisAccountCmd(comdex.DefaultNodeHome), - //AddGenesisWasmMsgCmd(comdex.DefaultNodeHome), + // AddGenesisWasmMsgCmd(comdex.DefaultNodeHome), tmcli.NewCompletionCmd(rootCmd, true), testnetCmd(comdex.ModuleBasics, banktypes.GenesisBalancesIterator{}), debug.Cmd(), diff --git a/x/asset/client/cli/tx.go b/x/asset/client/cli/tx.go index d3de6e90f..0d0f14275 100644 --- a/x/asset/client/cli/tx.go +++ b/x/asset/client/cli/tx.go @@ -903,7 +903,7 @@ func NewCreateMultipleAssetsPairs(clientCtx client.Context, txf tx.Factory, fs * if !ok { return txf, nil, types.ErrorInvalidDecimals } - newAssetOut, ok := sdk.NewIntFromString(assetOut[i]) + newAssetOut, _ := sdk.NewIntFromString(assetOut[i]) assets = append(assets, types.AssetPair{ Name: names[i],