Skip to content

Commit

Permalink
Merge PR #5068: Add linter Nakedret
Browse files Browse the repository at this point in the history
  • Loading branch information
tac0turtle authored and alexanderbez committed Sep 19, 2019
1 parent 5fd6a84 commit 01d8a23
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 24 deletions.
1 change: 0 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ linters:
- unparam
- lll
- maligned
- nakedret
- errcheck
- scopelint
- varcheck
Expand Down
4 changes: 2 additions & 2 deletions baseapp/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
11 changes: 7 additions & 4 deletions client/context/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion server/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func interceptLoadConfig() (conf *cfg.Config, err error) {
viper.SetConfigName("app")
err = viper.MergeInConfig()

return
return conf, err
}

// add server commands
Expand Down
2 changes: 1 addition & 1 deletion store/iavl/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ func (st *Store) Query(req abci.RequestQuery) (res abci.ResponseQuery) {
return serrors.ErrUnknownRequest(msg).QueryResult()
}

return
return res
}

//----------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion store/types/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/gobash.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
9 changes: 1 addition & 8 deletions x/auth/client/cli/decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -39,7 +32,7 @@ func GetDecodeCommand(codec *amino.Codec) *cobra.Command {
return err
}

return cliCtx.PrintOutput(txDecodeRespTx(stdTx))
return cliCtx.PrintOutput(stdTx)
},
}

Expand Down
4 changes: 1 addition & 3 deletions x/auth/client/cli/encode.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
},
}

Expand Down
2 changes: 1 addition & 1 deletion x/auth/simulation/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,5 +124,5 @@ func RandomGenesisAccounts(simState *module.SimulationState) (genesisAccs export
genesisAccs = append(genesisAccs, gacc)
}

return
return genesisAccs
}
2 changes: 1 addition & 1 deletion x/distribution/keeper/querier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 01d8a23

Please sign in to comment.