From c77bb7b038e9876a98dbf4c89f2bc794e960d3e5 Mon Sep 17 00:00:00 2001 From: Alessio Treglia Date: Sun, 16 Feb 2020 19:06:45 +0000 Subject: [PATCH] Squash various linter warnings (#5652) Closes: #5651 --- server/export.go | 2 +- server/util.go | 4 ++-- x/distribution/types/params_test.go | 2 +- x/genutil/client/cli/init.go | 4 ++-- x/slashing/app_test.go | 1 - x/staking/app_test.go | 4 ++-- 6 files changed, 8 insertions(+), 9 deletions(-) diff --git a/server/export.go b/server/export.go index e2e74943be..b4f52f639c 100644 --- a/server/export.go +++ b/server/export.go @@ -24,7 +24,7 @@ const ( ) // ExportCmd dumps app state to JSON. -func ExportCmd(ctx *Context, cdc *codec.Codec, appExporter AppExporter) *cobra.Command { +func ExportCmd(ctx *Context, cdc codec.JSONMarshaler, appExporter AppExporter) *cobra.Command { cmd := &cobra.Command{ Use: "export", Short: "Export state to JSON", diff --git a/server/util.go b/server/util.go index eb22c23026..0f4f62945c 100644 --- a/server/util.go +++ b/server/util.go @@ -118,7 +118,7 @@ func interceptLoadConfig() (conf *cfg.Config, err error) { // add server commands func AddCommands( - ctx *Context, cdc *codec.Codec, + ctx *Context, cdc codec.JSONMarshaler, rootCmd *cobra.Command, appCreator AppCreator, appExport AppExporter) { @@ -154,7 +154,7 @@ func AddCommands( // // NOTE: The ordering of the keys returned as the resulting JSON message is // non-deterministic, so the client should not rely on key ordering. -func InsertKeyJSON(cdc *codec.Codec, baseJSON []byte, key string, value json.RawMessage) ([]byte, error) { +func InsertKeyJSON(cdc codec.JSONMarshaler, baseJSON []byte, key string, value json.RawMessage) ([]byte, error) { var jsonMap map[string]json.RawMessage if err := cdc.UnmarshalJSON(baseJSON, &jsonMap); err != nil { diff --git a/x/distribution/types/params_test.go b/x/distribution/types/params_test.go index 143e2d30d7..cf25016047 100644 --- a/x/distribution/types/params_test.go +++ b/x/distribution/types/params_test.go @@ -24,7 +24,7 @@ func Test_validateAuxFuncs(t *testing.T) { {"two dec", args{sdk.NewDec(2)}, true}, } for _, tt := range tests { - tt = tt + tt := tt t.Run(tt.name, func(t *testing.T) { require.Equal(t, tt.wantErr, validateCommunityTax(tt.args.i) != nil) require.Equal(t, tt.wantErr, validateBaseProposerReward(tt.args.i) != nil) diff --git a/x/genutil/client/cli/init.go b/x/genutil/client/cli/init.go index b87691d1d0..618f389da5 100644 --- a/x/genutil/client/cli/init.go +++ b/x/genutil/client/cli/init.go @@ -48,7 +48,7 @@ func newPrintInfo(moniker, chainID, nodeID, genTxsDir string, } } -func displayInfo(cdc *codec.Codec, info printInfo) error { +func displayInfo(cdc codec.JSONMarshaler, info printInfo) error { out, err := codec.MarshalJSONIndent(cdc, info) if err != nil { return err @@ -60,7 +60,7 @@ func displayInfo(cdc *codec.Codec, info printInfo) error { // InitCmd returns a command that initializes all files needed for Tendermint // and the respective application. -func InitCmd(ctx *server.Context, cdc *codec.Codec, mbm module.BasicManager, +func InitCmd(ctx *server.Context, cdc codec.JSONMarshaler, mbm module.BasicManager, defaultNodeHome string) *cobra.Command { // nolint: golint cmd := &cobra.Command{ Use: "init [moniker]", diff --git a/x/slashing/app_test.go b/x/slashing/app_test.go index 1cb0fcd437..262e0227f1 100644 --- a/x/slashing/app_test.go +++ b/x/slashing/app_test.go @@ -20,7 +20,6 @@ import ( var ( priv1 = secp256k1.GenPrivKey() addr1 = sdk.AccAddress(priv1.PubKey().Address()) - coins = sdk.Coins{sdk.NewInt64Coin("foocoin", 10)} ) func checkValidator(t *testing.T, app *simapp.SimApp, addr sdk.AccAddress, expFound bool) staking.Validator { diff --git a/x/staking/app_test.go b/x/staking/app_test.go index 03aab5d643..f013e6323b 100644 --- a/x/staking/app_test.go +++ b/x/staking/app_test.go @@ -49,11 +49,11 @@ func TestStakingMsgs(t *testing.T) { acc2 := &auth.BaseAccount{Address: addr2} accs := authexported.GenesisAccounts{acc1, acc2} balances := []bank.Balance{ - bank.Balance{ + { Address: addr1, Coins: sdk.Coins{genCoin}, }, - bank.Balance{ + { Address: addr2, Coins: sdk.Coins{genCoin}, },