Merge PR #5068: Add linter Nakedret

This commit is contained in:
Marko 2019-09-19 15:21:38 +02:00 committed by Alexander Bezobchuk
parent 5fd6a842fb
commit 01d8a230b2
11 changed files with 17 additions and 24 deletions

View File

@ -12,7 +12,6 @@ linters:
- unparam
- lll
- maligned
- nakedret
- errcheck
- scopelint
- varcheck

View File

@ -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.

View File

@ -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

View File

@ -113,7 +113,7 @@ func interceptLoadConfig() (conf *cfg.Config, err error) {
viper.SetConfigName("app")
err = viper.MergeInConfig()
return
return conf, err
}
// add server commands

View File

@ -300,7 +300,7 @@ func (st *Store) Query(req abci.RequestQuery) (res abci.ResponseQuery) {
return serrors.ErrUnknownRequest(msg).QueryResult()
}
return
return res
}
//----------------------------------------

View File

@ -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

View File

@ -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.

View File

@ -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)
},
}

View File

@ -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)
},
}

View File

@ -124,5 +124,5 @@ func RandomGenesisAccounts(simState *module.SimulationState) (genesisAccs export
genesisAccs = append(genesisAccs, gacc)
}
return
return genesisAccs
}

View File

@ -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) {