Merge PR #5613: update to golangci-lint v1.23.3

Co-authored-by: Jack Zampolin <jack.zampolin@gmail.com>
This commit is contained in:
Erik Grinaker 2020-02-05 20:32:45 +01:00 committed by GitHub
parent 30d5f7daf3
commit a7f25ade03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 24 additions and 35 deletions

View File

@ -47,6 +47,11 @@ issues:
- text: "ST1003:"
linters:
- stylecheck
# FIXME disabled until golangci-lint updates stylecheck with this fix:
# https://github.com/dominikh/go-tools/issues/389
- text: "ST1016:"
linters:
- stylecheck
linters-settings:
dogsled:

View File

@ -425,7 +425,7 @@ func TestKeygenOverride(t *testing.T) {
overrideCalled := false
dummyFunc := func(bz []byte, algo SigningAlgo) (crypto.PrivKey, error) {
overrideCalled = true
return testPriv(bz[:]), nil
return testPriv(bz), nil
}
kb := New("keybasename", dir, WithKeygenFunc(dummyFunc))

View File

@ -367,8 +367,8 @@ func TestBech32ifyAddressBytes(t *testing.T) {
{"20-byte address", args{"prefixB", addr20byte}, "prefixB1qqqsyqcyq5rqwzqfpg9scrgwpugpzysn8e9wka", false},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
tt := tt
got, err := types.Bech32ifyAddressBytes(tt.args.prefix, tt.args.bs)
if (err != nil) != tt.wantErr {
t.Errorf("Bech32ifyBytes() error = %v, wantErr %v", err, tt.wantErr)
@ -400,8 +400,8 @@ func TestMustBech32ifyAddressBytes(t *testing.T) {
{"20-byte address", args{"prefixB", addr20byte}, "prefixB1qqqsyqcyq5rqwzqfpg9scrgwpugpzysn8e9wka", false},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
tt := tt
if tt.wantPanic {
require.Panics(t, func() { types.MustBech32ifyAddressBytes(tt.args.prefix, tt.args.bs) })
return

View File

@ -330,12 +330,6 @@ func TestSerializationGocodecJSON(t *testing.T) {
require.True(t, d.Equal(d2), "original: %v, unmarshalled: %v", d, d2)
}
type testDEmbedStruct struct {
Field1 string `json:"f1"`
Field2 int `json:"f2"`
Field3 Dec `json:"f3"`
}
func TestStringOverflow(t *testing.T) {
// two random 64 bit primes
dec1, err := NewDecFromStr("51643150036226787134389711697696177267")

View File

@ -50,7 +50,7 @@ func NewSimulationManager(modules ...AppModuleSimulation) *SimulationManager {
// GetProposalContents returns each module's proposal content generator function
// with their default operation weight and key.
func (sm *SimulationManager) GetProposalContents(simState SimulationState) []simulation.WeightedProposalContent {
var wContents []simulation.WeightedProposalContent
wContents := make([]simulation.WeightedProposalContent, 0, len(sm.Modules))
for _, module := range sm.Modules {
wContents = append(wContents, module.ProposalContents(simState)...)
}
@ -87,7 +87,7 @@ func (sm *SimulationManager) GenerateParamChanges(seed int64) (paramChanges []si
// WeightedOperations returns all the modules' weighted operations of an application
func (sm *SimulationManager) WeightedOperations(simState SimulationState) []simulation.WeightedOperation {
var wOps []simulation.WeightedOperation
wOps := make([]simulation.WeightedOperation, 0, len(sm.Modules))
for _, module := range sm.Modules {
wOps = append(wOps, module.WeightedOperations(simState)...)
}

View File

@ -53,7 +53,6 @@ func WeightedOperations(
// SimulateMsgSend tests and runs a single msg send where both
// accounts already exist.
// nolint: funlen
func SimulateMsgSend(ak types.AccountKeeper, bk keeper.Keeper) simulation.Operation {
return func(
r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context,
@ -127,7 +126,6 @@ func sendMsgSend(
// SimulateMsgMultiSend tests and runs a single msg multisend, with randomized, capped number of inputs/outputs.
// all accounts in msg fields exist in state
// nolint: funlen
func SimulateMsgMultiSend(ak types.AccountKeeper, bk keeper.Keeper) simulation.Operation {
return func(
r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context,

View File

@ -11,7 +11,7 @@ import (
)
func TestSetWithdrawAddr(t *testing.T) {
ctx, _, _, keeper, _, _ := CreateTestInputDefault(t, false, 1000) // nolint: dogseld
ctx, _, _, keeper, _, _ := CreateTestInputDefault(t, false, 1000) // nolint: dogsled
params := keeper.GetParams(ctx)
params.WithdrawAddrEnabled = false
@ -79,7 +79,7 @@ func TestWithdrawValidatorCommission(t *testing.T) {
}
func TestGetTotalRewards(t *testing.T) {
ctx, _, _, keeper, _, _ := CreateTestInputDefault(t, false, 1000) // nolint: dogseld
ctx, _, _, keeper, _, _ := CreateTestInputDefault(t, false, 1000) // nolint: dogsled
valCommission := sdk.DecCoins{
sdk.NewDecCoinFromDec("mytoken", sdk.NewDec(5).Quo(sdk.NewDec(4))),

View File

@ -78,7 +78,6 @@ func WeightedOperations(
}
// SimulateMsgSetWithdrawAddress generates a MsgSetWithdrawAddress with random values.
// nolint: funlen
func SimulateMsgSetWithdrawAddress(ak types.AccountKeeper, bk types.BankKeeper, k keeper.Keeper) simulation.Operation {
return func(
r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simulation.Account, chainID string,
@ -120,7 +119,6 @@ func SimulateMsgSetWithdrawAddress(ak types.AccountKeeper, bk types.BankKeeper,
}
// SimulateMsgWithdrawDelegatorReward generates a MsgWithdrawDelegatorReward with random values.
// nolint: funlen
func SimulateMsgWithdrawDelegatorReward(ak types.AccountKeeper, bk types.BankKeeper, k keeper.Keeper, sk stakingkeeper.Keeper) simulation.Operation {
return func(
r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simulation.Account, chainID string,
@ -168,7 +166,6 @@ func SimulateMsgWithdrawDelegatorReward(ak types.AccountKeeper, bk types.BankKee
}
// SimulateMsgWithdrawValidatorCommission generates a MsgWithdrawValidatorCommission with random values.
// nolint: funlen
func SimulateMsgWithdrawValidatorCommission(ak types.AccountKeeper, bk types.BankKeeper, k keeper.Keeper, sk stakingkeeper.Keeper) simulation.Operation {
return func(
r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simulation.Account, chainID string,

View File

@ -26,7 +26,6 @@ func ProposalContents(k keeper.Keeper) []simulation.WeightedProposalContent {
}
// SimulateCommunityPoolSpendProposalContent generates random community-pool-spend proposal content
// nolint: funlen
func SimulateCommunityPoolSpendProposalContent(k keeper.Keeper) simulation.ContentSimulatorFn {
return func(r *rand.Rand, ctx sdk.Context, accs []simulation.Account) govtypes.Content {
simAccount, _ := simulation.RandomAcc(r, accs)

View File

@ -53,7 +53,6 @@ func GetMigrationVersions() []string {
}
// MigrateGenesisCmd returns a command to execute genesis state migration.
// nolint: funlen
func MigrateGenesisCmd(_ *server.Context, cdc *codec.Codec) *cobra.Command {
cmd := &cobra.Command{
Use: "migrate [target-version] [genesis-file]",

View File

@ -81,7 +81,6 @@ func WeightedOperations(
// SimulateSubmitProposal simulates creating a msg Submit Proposal
// voting on the proposal, and subsequently slashing the proposal. It is implemented using
// future operations.
// nolint: funlen
func SimulateSubmitProposal(
ak types.AccountKeeper, bk types.BankKeeper, k keeper.Keeper, contentSim simulation.ContentSimulatorFn,
) simulation.Operation {
@ -188,7 +187,6 @@ func SimulateSubmitProposal(
}
// SimulateMsgDeposit generates a MsgDeposit with random values.
// nolint: funlen
func SimulateMsgDeposit(ak types.AccountKeeper, bk types.BankKeeper, k keeper.Keeper) simulation.Operation {
return func(
r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context,
@ -242,7 +240,6 @@ func SimulateMsgDeposit(ak types.AccountKeeper, bk types.BankKeeper, k keeper.Ke
}
// SimulateMsgVote generates a MsgVote with random values.
// nolint: funlen
func SimulateMsgVote(ak types.AccountKeeper, bk types.BankKeeper, k keeper.Keeper) simulation.Operation {
return operationSimulateMsgVote(ak, bk, k, simulation.Account{}, -1)
}

View File

@ -210,7 +210,7 @@ func CreateGenAccounts(numAccs int, genCoins sdk.Coins) (
})
}
return
return // nolint
}
// SetGenesis sets the mock app genesis accounts.

View File

@ -42,7 +42,7 @@ func WeightedOperations(
}
// SimulateMsgUnjail generates a MsgUnjail with random values
// nolint: funlen interfacer
// nolint: interfacer
func SimulateMsgUnjail(ak types.AccountKeeper, bk types.BankKeeper, k keeper.Keeper, sk stakingkeeper.Keeper) simulation.Operation {
return func(
r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context,

View File

@ -27,7 +27,7 @@ func TestHistoricalInfo(t *testing.T) {
recv, found := keeper.GetHistoricalInfo(ctx, 2)
require.True(t, found, "HistoricalInfo not found after set")
require.Equal(t, hi, recv, "HistoricalInfo not equal")
require.True(t, sort.IsSorted(types.Validators(recv.ValSet)), "HistoricalInfo validators is not sorted")
require.True(t, sort.IsSorted(recv.ValSet), "HistoricalInfo validators is not sorted")
keeper.DeleteHistoricalInfo(ctx, 2)

View File

@ -92,7 +92,7 @@ func WeightedOperations(
}
// SimulateMsgCreateValidator generates a MsgCreateValidator with random values
// nolint: funlen interfacer
// nolint: interfacer
func SimulateMsgCreateValidator(ak types.AccountKeeper, bk types.BankKeeper, k keeper.Keeper) simulation.Operation {
return func(
r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simulation.Account, chainID string,
@ -171,7 +171,7 @@ func SimulateMsgCreateValidator(ak types.AccountKeeper, bk types.BankKeeper, k k
}
// SimulateMsgEditValidator generates a MsgEditValidator with random values
// nolint: funlen interfacer
// nolint: interfacer
func SimulateMsgEditValidator(ak types.AccountKeeper, bk types.BankKeeper, k keeper.Keeper) simulation.Operation {
return func(
r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simulation.Account, chainID string,
@ -238,7 +238,7 @@ func SimulateMsgEditValidator(ak types.AccountKeeper, bk types.BankKeeper, k kee
}
// SimulateMsgDelegate generates a MsgDelegate with random values
// nolint: funlen interfacer
// nolint: interfacer
func SimulateMsgDelegate(ak types.AccountKeeper, bk types.BankKeeper, k keeper.Keeper) simulation.Operation {
return func(
r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simulation.Account, chainID string,
@ -305,7 +305,7 @@ func SimulateMsgDelegate(ak types.AccountKeeper, bk types.BankKeeper, k keeper.K
}
// SimulateMsgUndelegate generates a MsgUndelegate with random values
// nolint: funlen,interfacer
// nolint: interfacer
func SimulateMsgUndelegate(ak types.AccountKeeper, bk types.BankKeeper, k keeper.Keeper) simulation.Operation {
return func(
r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simulation.Account, chainID string,
@ -387,7 +387,7 @@ func SimulateMsgUndelegate(ak types.AccountKeeper, bk types.BankKeeper, k keeper
}
// SimulateMsgBeginRedelegate generates a MsgBeginRedelegate with random values
// nolint: funlen,interfacer
// nolint: interfacer
func SimulateMsgBeginRedelegate(ak types.AccountKeeper, bk types.BankKeeper, k keeper.Keeper) simulation.Operation {
return func(
r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simulation.Account, chainID string,

View File

@ -50,7 +50,7 @@ func ValidateBasic(hi HistoricalInfo) error {
if len(hi.ValSet) == 0 {
return sdkerrors.Wrap(ErrInvalidHistoricalInfo, "validator set is empty")
}
if !sort.IsSorted(Validators(hi.ValSet)) {
if !sort.IsSorted(hi.ValSet) {
return sdkerrors.Wrap(ErrInvalidHistoricalInfo, "validator set is not sorted by address")
}
return nil

View File

@ -23,7 +23,7 @@ var (
func TestHistoricalInfo(t *testing.T) {
hi := NewHistoricalInfo(header, validators)
require.True(t, sort.IsSorted(Validators(hi.ValSet)), "Validators are not sorted")
require.True(t, sort.IsSorted(hi.ValSet), "Validators are not sorted")
var value []byte
require.NotPanics(t, func() {
@ -35,7 +35,7 @@ func TestHistoricalInfo(t *testing.T) {
recv, err := UnmarshalHistoricalInfo(ModuleCdc, value)
require.Nil(t, err, "Unmarshalling HistoricalInfo failed")
require.Equal(t, hi, recv, "Unmarshalled HistoricalInfo is different from original")
require.True(t, sort.IsSorted(Validators(hi.ValSet)), "Validators are not sorted")
require.True(t, sort.IsSorted(hi.ValSet), "Validators are not sorted")
}
func TestValidateBasic(t *testing.T) {

View File

@ -32,7 +32,7 @@ var (
)
type (
UpgradeHandler = types.UpgradeHandler
UpgradeHandler = types.UpgradeHandler // nolint
Plan = types.Plan
SoftwareUpgradeProposal = types.SoftwareUpgradeProposal
CancelSoftwareUpgradeProposal = types.CancelSoftwareUpgradeProposal