Merge PR #1429: tools: Add ineffassign linter

* tools: Add ineffassign linter

This errors on assignments that don't actually do anything. i.e.

x, err := myFunc(1)
y, err = myFunc(2)

This will call out that the first function's call error was never
used.

* Fix makefile, add misspell to makefile
This commit is contained in:
Dev Ojha
2018-06-28 19:12:02 +02:00
committed by Christopher Goes
parent 2755c66545
commit 3e14868bd6
13 changed files with 81 additions and 28 deletions
+12
View File
@@ -117,6 +117,9 @@ func GetCmdDelegate(cdc *wire.Codec) *cobra.Command {
}
delegatorAddr, err := sdk.GetAccAddressBech32(viper.GetString(FlagAddressDelegator))
if err != nil {
return err
}
validatorAddr, err := sdk.GetAccAddressBech32(viper.GetString(FlagAddressValidator))
if err != nil {
return err
@@ -259,7 +262,13 @@ func GetCmdCompleteRedelegate(cdc *wire.Codec) *cobra.Command {
RunE: func(cmd *cobra.Command, args []string) error {
delegatorAddr, err := sdk.GetAccAddressBech32(viper.GetString(FlagAddressDelegator))
if err != nil {
return err
}
validatorSrcAddr, err := sdk.GetAccAddressBech32(viper.GetString(FlagAddressValidatorSrc))
if err != nil {
return err
}
validatorDstAddr, err := sdk.GetAccAddressBech32(viper.GetString(FlagAddressValidatorDst))
if err != nil {
return err
@@ -351,6 +360,9 @@ func GetCmdCompleteUnbonding(cdc *wire.Codec) *cobra.Command {
RunE: func(cmd *cobra.Command, args []string) error {
delegatorAddr, err := sdk.GetAccAddressBech32(viper.GetString(FlagAddressDelegator))
if err != nil {
return err
}
validatorAddr, err := sdk.GetAccAddressBech32(viper.GetString(FlagAddressValidator))
if err != nil {
return err
+3
View File
@@ -321,6 +321,9 @@ func (k Keeper) BeginRedelegation(ctx sdk.Context, delegatorAddr, validatorSrcAd
return types.ErrBadRedelegationDst(k.Codespace())
}
sharesCreated, err := k.Delegate(ctx, delegatorAddr, returnCoin, dstValidator)
if err != nil {
return err
}
// create the unbonding delegation
minTime := ctx.BlockHeader().Time + params.UnbondingTime
+1 -1
View File
@@ -212,7 +212,7 @@ func TestLargeBond(t *testing.T) {
keeper.SetParams(ctx, params)
// validator[9] will be bonded, bringing us from 25% to ~50% (bonding 400,000,000 tokens)
pool, validator, _, _ = types.OpBondOrUnbond(r, pool, validator)
pool, _, _, _ = types.OpBondOrUnbond(r, pool, validator)
keeper.SetPool(ctx, pool)
// process provisions after the bonding, to compare the difference in expProvisions and expInflation
+2
View File
@@ -34,6 +34,7 @@ func TestSetValidator(t *testing.T) {
// Check each store for being saved
resVal, found := keeper.GetValidator(ctx, addrVals[0])
assert.True(ValEq(t, validator, resVal))
assert.True(t, found)
resVals := keeper.GetValidatorsBonded(ctx)
require.Equal(t, 1, len(resVals))
@@ -87,6 +88,7 @@ func TestUpdateValidatorByPowerIndex(t *testing.T) {
pool = keeper.GetPool(ctx)
validator, found = keeper.GetValidator(ctx, addrVals[0])
assert.True(t, found)
power = GetValidatorsByPowerIndexKey(validator, pool)
assert.True(t, keeper.validatorByPowerIndexExists(ctx, power))
}