From 38144e7af3015154f70d12a04ed183acf2e78cd9 Mon Sep 17 00:00:00 2001 From: gopherjk121 Date: Fri, 12 Jan 2024 10:56:49 +0800 Subject: [PATCH] resolve lint issue --- app/fee.go | 3 +-- cmd/teritorid/cmd/richest_snapshot.go | 2 +- x/airdrop/client/cli/fetch_and_remove_airdrop.go | 3 +++ x/airdrop/client/cli/tx.go | 6 ++++++ x/mint/client/cli/tx.go | 3 +++ x/mint/keeper/keeper.go | 10 ---------- x/mint/types/params.go | 5 ++++- 7 files changed, 18 insertions(+), 14 deletions(-) diff --git a/app/fee.go b/app/fee.go index 8c5c47d..385b7cf 100644 --- a/app/fee.go +++ b/app/fee.go @@ -68,9 +68,8 @@ func (dfd DeductFeeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bo msgs := tx.GetMsgs() if len(msgs) == 1 { msg := msgs[0] - switch msg.(type) { + switch msg := msg.(type) { case *airdroptypes.MsgClaimAllocation: - msg := msg.(*airdroptypes.MsgClaimAllocation) signer := msg.GetSigners()[0] cacheCtx, _ := ctx.CacheContext() if acc := dfd.ak.GetAccount(ctx, signer); acc == nil { diff --git a/cmd/teritorid/cmd/richest_snapshot.go b/cmd/teritorid/cmd/richest_snapshot.go index 0b240b4..ed5930c 100644 --- a/cmd/teritorid/cmd/richest_snapshot.go +++ b/cmd/teritorid/cmd/richest_snapshot.go @@ -141,7 +141,7 @@ Example: for _, delegation := range stakingGen.Delegations { address := delegation.DelegatorAddress - if excludeAddrs[address] == true { + if excludeAddrs[address] { continue } diff --git a/x/airdrop/client/cli/fetch_and_remove_airdrop.go b/x/airdrop/client/cli/fetch_and_remove_airdrop.go index 7b817c1..5bcacfb 100644 --- a/x/airdrop/client/cli/fetch_and_remove_airdrop.go +++ b/x/airdrop/client/cli/fetch_and_remove_airdrop.go @@ -44,6 +44,9 @@ func saveAllocation(path string, allocations []airdroptypes.AirdropAllocation) { } f, err := os.Create(path) + if err != nil { + panic(err) + } defer f.Close() if err != nil { diff --git a/x/airdrop/client/cli/tx.go b/x/airdrop/client/cli/tx.go index cc7b57f..32a2b78 100644 --- a/x/airdrop/client/cli/tx.go +++ b/x/airdrop/client/cli/tx.go @@ -41,6 +41,9 @@ func GetTxClaimAllocationCmd() *cobra.Command { Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } msg := types.NewMsgClaimAllocation( args[0], @@ -71,6 +74,9 @@ func GetTxSetAllocationCmd() *cobra.Command { Args: cobra.ExactArgs(4), RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } amount, err := sdk.ParseCoinNormalized(args[2]) if err != nil { diff --git a/x/mint/client/cli/tx.go b/x/mint/client/cli/tx.go index 720fd61..a602539 100644 --- a/x/mint/client/cli/tx.go +++ b/x/mint/client/cli/tx.go @@ -36,6 +36,9 @@ func GetTxBurnTokensCmd() *cobra.Command { Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } amount, err := sdk.ParseCoinsNormalized(args[0]) if err != nil { diff --git a/x/mint/keeper/keeper.go b/x/mint/keeper/keeper.go index da4610a..1e8bdcf 100644 --- a/x/mint/keeper/keeper.go +++ b/x/mint/keeper/keeper.go @@ -3,7 +3,6 @@ package keeper import ( "fmt" - "cosmossdk.io/math" "github.com/cometbft/cometbft/libs/log" "github.com/TERITORI/teritori-chain/x/mint/types" @@ -35,15 +34,6 @@ func (e invalidRatioError) Error() string { return fmt.Sprintf("mint allocation ratio (%s) is greater than 1", e.ActualRatio) } -type insufficientDevVestingBalanceError struct { - ActualBalance math.Int - AttemptedDistribution math.Int -} - -func (e insufficientDevVestingBalanceError) Error() string { - return fmt.Sprintf("developer vesting balance (%s) is smaller than requested distribution of (%s)", e.ActualBalance, e.AttemptedDistribution) -} - const emptyAddressReceiver = "" // NewKeeper creates a new mint Keeper instance. diff --git a/x/mint/types/params.go b/x/mint/types/params.go index 911289a..7d011b1 100644 --- a/x/mint/types/params.go +++ b/x/mint/types/params.go @@ -87,7 +87,10 @@ func addressTable() map[string]string { }` var addressMap map[string]string - json.Unmarshal([]byte(addressJSON), &addressMap) + err := json.Unmarshal([]byte(addressJSON), &addressMap) + if err != nil { + panic(err) + } return addressMap }