Merge PR #5068: Add linter Nakedret
This commit is contained in:
parent
5fd6a842fb
commit
01d8a230b2
|
@ -12,7 +12,6 @@ linters:
|
||||||
- unparam
|
- unparam
|
||||||
- lll
|
- lll
|
||||||
- maligned
|
- maligned
|
||||||
- nakedret
|
|
||||||
- errcheck
|
- errcheck
|
||||||
- scopelint
|
- scopelint
|
||||||
- varcheck
|
- varcheck
|
||||||
|
|
|
@ -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
|
// NOTE: We don't commit, but BeginBlock for block 1 starts from this
|
||||||
// deliverState.
|
// deliverState.
|
||||||
return
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
// Info implements the ABCI interface.
|
// 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
|
// set the signed validators for addition to context in deliverTx
|
||||||
app.voteInfos = req.LastCommitInfo.GetVotes()
|
app.voteInfos = req.LastCommitInfo.GetVotes()
|
||||||
return
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
// EndBlock implements the ABCI interface.
|
// EndBlock implements the ABCI interface.
|
||||||
|
|
|
@ -241,8 +241,11 @@ func (ctx CLIContext) WithBroadcastMode(mode string) CLIContext {
|
||||||
// PrintOutput prints output while respecting output and indent flags
|
// PrintOutput prints output while respecting output and indent flags
|
||||||
// NOTE: pass in marshalled structs that have been unmarshaled
|
// NOTE: pass in marshalled structs that have been unmarshaled
|
||||||
// because this function will panic on marshaling errors
|
// because this function will panic on marshaling errors
|
||||||
func (ctx CLIContext) PrintOutput(toPrint fmt.Stringer) (err error) {
|
func (ctx CLIContext) PrintOutput(toPrint interface{}) error {
|
||||||
var out []byte
|
var (
|
||||||
|
out []byte
|
||||||
|
err error
|
||||||
|
)
|
||||||
|
|
||||||
switch ctx.OutputFormat {
|
switch ctx.OutputFormat {
|
||||||
case "text":
|
case "text":
|
||||||
|
@ -257,11 +260,11 @@ func (ctx CLIContext) PrintOutput(toPrint fmt.Stringer) (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println(string(out))
|
fmt.Println(string(out))
|
||||||
return
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetFromFields returns a from account address and Keybase name given either
|
// GetFromFields returns a from account address and Keybase name given either
|
||||||
|
|
|
@ -113,7 +113,7 @@ func interceptLoadConfig() (conf *cfg.Config, err error) {
|
||||||
viper.SetConfigName("app")
|
viper.SetConfigName("app")
|
||||||
err = viper.MergeInConfig()
|
err = viper.MergeInConfig()
|
||||||
|
|
||||||
return
|
return conf, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// add server commands
|
// add server commands
|
||||||
|
|
|
@ -300,7 +300,7 @@ func (st *Store) Query(req abci.RequestQuery) (res abci.ResponseQuery) {
|
||||||
return serrors.ErrUnknownRequest(msg).QueryResult()
|
return serrors.ErrUnknownRequest(msg).QueryResult()
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------
|
//----------------------------------------
|
||||||
|
|
|
@ -51,7 +51,7 @@ func DiffKVStores(a KVStore, b KVStore, prefixesToSkip [][]byte) (kvAs, kvBs []c
|
||||||
kvBs = append(kvBs, kvB)
|
kvBs = append(kvBs, kvB)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return
|
return kvAs, kvBs
|
||||||
}
|
}
|
||||||
|
|
||||||
// PrefixEndBytes returns the []byte that would end a
|
// PrefixEndBytes returns the []byte that would end a
|
||||||
|
|
|
@ -52,7 +52,7 @@ func ExecuteT(t *testing.T, cmd, input string) (stdout, stderr string) {
|
||||||
stdout = strings.Trim(string(outbz), "\n")
|
stdout = strings.Trim(string(outbz), "\n")
|
||||||
stderr = strings.Trim(string(errbz), "\n")
|
stderr = strings.Trim(string(errbz), "\n")
|
||||||
|
|
||||||
return
|
return stdout, stderr
|
||||||
}
|
}
|
||||||
|
|
||||||
// Execute the command, launch goroutines to log stdout/err to t.
|
// Execute the command, launch goroutines to log stdout/err to t.
|
||||||
|
|
|
@ -11,13 +11,6 @@ import (
|
||||||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
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
|
// GetDecodeCommand returns the decode command to take Amino-serialized bytes
|
||||||
// and turn it into a JSONified transaction.
|
// and turn it into a JSONified transaction.
|
||||||
func GetDecodeCommand(codec *amino.Codec) *cobra.Command {
|
func GetDecodeCommand(codec *amino.Codec) *cobra.Command {
|
||||||
|
@ -39,7 +32,7 @@ func GetDecodeCommand(codec *amino.Codec) *cobra.Command {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return cliCtx.PrintOutput(txDecodeRespTx(stdTx))
|
return cliCtx.PrintOutput(stdTx)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,9 +46,7 @@ If you supply a dash (-) argument in place of an input filename, the command rea
|
||||||
txBytesBase64 := base64.StdEncoding.EncodeToString(txBytes)
|
txBytesBase64 := base64.StdEncoding.EncodeToString(txBytes)
|
||||||
|
|
||||||
response := txEncodeRespStr(txBytesBase64)
|
response := txEncodeRespStr(txBytesBase64)
|
||||||
cliCtx.PrintOutput(response) // nolint:errcheck
|
return cliCtx.PrintOutput(response)
|
||||||
|
|
||||||
return nil
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -124,5 +124,5 @@ func RandomGenesisAccounts(simState *module.SimulationState) (genesisAccs export
|
||||||
genesisAccs = append(genesisAccs, gacc)
|
genesisAccs = append(genesisAccs, gacc)
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return genesisAccs
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ func getQueriedParams(t *testing.T, ctx sdk.Context, cdc *codec.Codec, querier s
|
||||||
require.Nil(t, err)
|
require.Nil(t, err)
|
||||||
require.Nil(t, cdc.UnmarshalJSON(bz, &withdrawAddrEnabled))
|
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) {
|
func getQueriedValidatorOutstandingRewards(t *testing.T, ctx sdk.Context, cdc *codec.Codec, querier sdk.Querier, validatorAddr sdk.ValAddress) (outstandingRewards sdk.DecCoins) {
|
||||||
|
|
Loading…
Reference in New Issue