diff --git a/.golangci.yml b/.golangci.yml index 9ccc39b8e206..c6548a3abe0a 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -12,7 +12,6 @@ linters: - unparam - lll - maligned - - nakedret - errcheck - scopelint - varcheck diff --git a/baseapp/abci.go b/baseapp/abci.go index d2fc35e84770..4fa777d3abc8 100644 --- a/baseapp/abci.go +++ b/baseapp/abci.go @@ -60,7 +60,7 @@ func (app *BaseApp) InitChain(req abci.RequestInitChain) (res abci.ResponseInitC // NOTE: We don't commit, but BeginBlock for block 1 starts from this // deliverState. - return + return res } // Info implements the ABCI interface. @@ -137,7 +137,7 @@ func (app *BaseApp) BeginBlock(req abci.RequestBeginBlock) (res abci.ResponseBeg // set the signed validators for addition to context in deliverTx app.voteInfos = req.LastCommitInfo.GetVotes() - return + return res } // EndBlock implements the ABCI interface. diff --git a/client/context/context.go b/client/context/context.go index 18f50240d4b6..398b8c908340 100644 --- a/client/context/context.go +++ b/client/context/context.go @@ -241,8 +241,11 @@ func (ctx CLIContext) WithBroadcastMode(mode string) CLIContext { // PrintOutput prints output while respecting output and indent flags // NOTE: pass in marshalled structs that have been unmarshaled // because this function will panic on marshaling errors -func (ctx CLIContext) PrintOutput(toPrint fmt.Stringer) (err error) { - var out []byte +func (ctx CLIContext) PrintOutput(toPrint interface{}) error { + var ( + out []byte + err error + ) switch ctx.OutputFormat { case "text": @@ -257,11 +260,11 @@ func (ctx CLIContext) PrintOutput(toPrint fmt.Stringer) (err error) { } if err != nil { - return + return err } fmt.Println(string(out)) - return + return nil } // GetFromFields returns a from account address and Keybase name given either diff --git a/server/util.go b/server/util.go index 20eecfe154d3..3926a37f4e68 100644 --- a/server/util.go +++ b/server/util.go @@ -113,7 +113,7 @@ func interceptLoadConfig() (conf *cfg.Config, err error) { viper.SetConfigName("app") err = viper.MergeInConfig() - return + return conf, err } // add server commands diff --git a/store/iavl/store.go b/store/iavl/store.go index 4a9f0957fec9..f7e603962de6 100644 --- a/store/iavl/store.go +++ b/store/iavl/store.go @@ -300,7 +300,7 @@ func (st *Store) Query(req abci.RequestQuery) (res abci.ResponseQuery) { return serrors.ErrUnknownRequest(msg).QueryResult() } - return + return res } //---------------------------------------- diff --git a/store/types/utils.go b/store/types/utils.go index 2abd6db62b07..0c45933ed4a9 100644 --- a/store/types/utils.go +++ b/store/types/utils.go @@ -51,7 +51,7 @@ func DiffKVStores(a KVStore, b KVStore, prefixesToSkip [][]byte) (kvAs, kvBs []c kvBs = append(kvBs, kvB) } } - return + return kvAs, kvBs } // PrefixEndBytes returns the []byte that would end a diff --git a/tests/gobash.go b/tests/gobash.go index 02a113574237..29a703479ee3 100644 --- a/tests/gobash.go +++ b/tests/gobash.go @@ -52,7 +52,7 @@ func ExecuteT(t *testing.T, cmd, input string) (stdout, stderr string) { stdout = strings.Trim(string(outbz), "\n") stderr = strings.Trim(string(errbz), "\n") - return + return stdout, stderr } // Execute the command, launch goroutines to log stdout/err to t. diff --git a/x/auth/client/cli/decode.go b/x/auth/client/cli/decode.go index 3f706647899c..3d8fa1f3ceca 100644 --- a/x/auth/client/cli/decode.go +++ b/x/auth/client/cli/decode.go @@ -11,13 +11,6 @@ import ( authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) -// txDecodeRespTx implements a simple Stringer wrapper for a decoded StdTx. -type txDecodeRespTx authtypes.StdTx - -func (tx txDecodeRespTx) String() string { - return tx.String() -} - // GetDecodeCommand returns the decode command to take Amino-serialized bytes // and turn it into a JSONified transaction. func GetDecodeCommand(codec *amino.Codec) *cobra.Command { @@ -39,7 +32,7 @@ func GetDecodeCommand(codec *amino.Codec) *cobra.Command { return err } - return cliCtx.PrintOutput(txDecodeRespTx(stdTx)) + return cliCtx.PrintOutput(stdTx) }, } diff --git a/x/auth/client/cli/encode.go b/x/auth/client/cli/encode.go index 508a8eae8647..304411dba8a1 100644 --- a/x/auth/client/cli/encode.go +++ b/x/auth/client/cli/encode.go @@ -46,9 +46,7 @@ If you supply a dash (-) argument in place of an input filename, the command rea txBytesBase64 := base64.StdEncoding.EncodeToString(txBytes) response := txEncodeRespStr(txBytesBase64) - cliCtx.PrintOutput(response) // nolint:errcheck - - return nil + return cliCtx.PrintOutput(response) }, } diff --git a/x/auth/simulation/genesis.go b/x/auth/simulation/genesis.go index 39906df7f91f..3a92a98b69d3 100644 --- a/x/auth/simulation/genesis.go +++ b/x/auth/simulation/genesis.go @@ -124,5 +124,5 @@ func RandomGenesisAccounts(simState *module.SimulationState) (genesisAccs export genesisAccs = append(genesisAccs, gacc) } - return + return genesisAccs } diff --git a/x/distribution/keeper/querier_test.go b/x/distribution/keeper/querier_test.go index b4a5d8e7d044..2a2d1455f9db 100644 --- a/x/distribution/keeper/querier_test.go +++ b/x/distribution/keeper/querier_test.go @@ -55,7 +55,7 @@ func getQueriedParams(t *testing.T, ctx sdk.Context, cdc *codec.Codec, querier s require.Nil(t, err) require.Nil(t, cdc.UnmarshalJSON(bz, &withdrawAddrEnabled)) - return + return communityTax, baseProposerReward, bonusProposerReward, withdrawAddrEnabled } func getQueriedValidatorOutstandingRewards(t *testing.T, ctx sdk.Context, cdc *codec.Codec, querier sdk.Querier, validatorAddr sdk.ValAddress) (outstandingRewards sdk.DecCoins) {