mirror of
https://github.com/tendermint/tendermint.git
synced 2025-12-23 14:25:19 +00:00
Bump linter to 1.47 (#9218)
*bump linter to 1.47 Co-authored-by: William Banfield <4561443+williambanfield@users.noreply.github.com>
This commit is contained in:
4
.github/workflows/lint.yml
vendored
4
.github/workflows/lint.yml
vendored
@@ -16,7 +16,7 @@ jobs:
|
|||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-go@v3
|
- uses: actions/setup-go@v3
|
||||||
with:
|
with:
|
||||||
go-version: '^1.16'
|
go-version: '1.18'
|
||||||
- uses: technote-space/get-diff-action@v6
|
- uses: technote-space/get-diff-action@v6
|
||||||
with:
|
with:
|
||||||
PATTERNS: |
|
PATTERNS: |
|
||||||
@@ -26,7 +26,7 @@ jobs:
|
|||||||
- uses: golangci/golangci-lint-action@v3
|
- uses: golangci/golangci-lint-action@v3
|
||||||
with:
|
with:
|
||||||
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
|
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
|
||||||
version: v1.45
|
version: v1.47.3
|
||||||
args: --timeout 10m
|
args: --timeout 10m
|
||||||
github-token: ${{ secrets.github_token }}
|
github-token: ${{ secrets.github_token }}
|
||||||
if: env.GIT_DIFF
|
if: env.GIT_DIFF
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ linters:
|
|||||||
enable:
|
enable:
|
||||||
- asciicheck
|
- asciicheck
|
||||||
- bodyclose
|
- bodyclose
|
||||||
- deadcode
|
# - deadcode
|
||||||
- depguard
|
- depguard
|
||||||
- dogsled
|
- dogsled
|
||||||
- dupl
|
- dupl
|
||||||
@@ -28,18 +28,22 @@ linters:
|
|||||||
# - maligned
|
# - maligned
|
||||||
# - misspell
|
# - misspell
|
||||||
- nakedret
|
- nakedret
|
||||||
- nolintlint
|
# - nolintlint
|
||||||
- prealloc
|
- prealloc
|
||||||
- staticcheck
|
- staticcheck
|
||||||
- structcheck
|
# - structcheck // to be fixed by golangci-lint
|
||||||
- stylecheck
|
- stylecheck
|
||||||
# - typecheck
|
# - typecheck
|
||||||
- unconvert
|
- unconvert
|
||||||
# - unparam
|
# - unparam
|
||||||
- unused
|
# - unused
|
||||||
- varcheck
|
- varcheck
|
||||||
# - whitespace
|
# - whitespace
|
||||||
# - wsl
|
# - wsl
|
||||||
|
disable:
|
||||||
|
- unused
|
||||||
|
- deadcode
|
||||||
|
- nolintlint
|
||||||
|
|
||||||
issues:
|
issues:
|
||||||
exclude-rules:
|
exclude-rules:
|
||||||
|
|||||||
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
@@ -5,4 +5,5 @@
|
|||||||
"--proto_path=${workspaceRoot}/third_party/proto"
|
"--proto_path=${workspaceRoot}/third_party/proto"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,22 +59,18 @@ func (mp mockPeer) TrySend(byte, []byte) bool { return true }
|
|||||||
func (mp mockPeer) Set(string, interface{}) {}
|
func (mp mockPeer) Set(string, interface{}) {}
|
||||||
func (mp mockPeer) Get(string) interface{} { return struct{}{} }
|
func (mp mockPeer) Get(string) interface{} { return struct{}{} }
|
||||||
|
|
||||||
// nolint:unused // ignore
|
|
||||||
type mockBlockStore struct {
|
type mockBlockStore struct {
|
||||||
blocks map[int64]*types.Block
|
blocks map[int64]*types.Block
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint:unused // ignore
|
|
||||||
func (ml *mockBlockStore) Height() int64 {
|
func (ml *mockBlockStore) Height() int64 {
|
||||||
return int64(len(ml.blocks))
|
return int64(len(ml.blocks))
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint:unused // ignore
|
|
||||||
func (ml *mockBlockStore) LoadBlock(height int64) *types.Block {
|
func (ml *mockBlockStore) LoadBlock(height int64) *types.Block {
|
||||||
return ml.blocks[height]
|
return ml.blocks[height]
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint:unused // ignore
|
|
||||||
func (ml *mockBlockStore) SaveBlock(block *types.Block, part *types.PartSet, commit *types.Commit) {
|
func (ml *mockBlockStore) SaveBlock(block *types.Block, part *types.PartSet, commit *types.Commit) {
|
||||||
ml.blocks[block.Height] = block
|
ml.blocks[block.Height] = block
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ func (rt *Routine) setLogger(logger log.Logger) {
|
|||||||
rt.logger = logger
|
rt.logger = logger
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint:unused
|
|
||||||
func (rt *Routine) setMetrics(metrics *Metrics) {
|
func (rt *Routine) setMetrics(metrics *Metrics) {
|
||||||
rt.metrics = metrics
|
rt.metrics = metrics
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -140,8 +140,8 @@ func TestFastSyncConfigValidateBasic(t *testing.T) {
|
|||||||
assert.Error(t, cfg.ValidateBasic())
|
assert.Error(t, cfg.ValidateBasic())
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestConsensusConfig_ValidateBasic(t *testing.T) {
|
|
||||||
// nolint: lll
|
// nolint: lll
|
||||||
|
func TestConsensusConfig_ValidateBasic(t *testing.T) {
|
||||||
testcases := map[string]struct {
|
testcases := map[string]struct {
|
||||||
modify func(*ConsensusConfig)
|
modify func(*ConsensusConfig)
|
||||||
expectErr bool
|
expectErr bool
|
||||||
@@ -166,6 +166,7 @@ func TestConsensusConfig_ValidateBasic(t *testing.T) {
|
|||||||
"PeerQueryMaj23SleepDuration negative": {func(c *ConsensusConfig) { c.PeerQueryMaj23SleepDuration = -1 }, true},
|
"PeerQueryMaj23SleepDuration negative": {func(c *ConsensusConfig) { c.PeerQueryMaj23SleepDuration = -1 }, true},
|
||||||
"DoubleSignCheckHeight negative": {func(c *ConsensusConfig) { c.DoubleSignCheckHeight = -1 }, true},
|
"DoubleSignCheckHeight negative": {func(c *ConsensusConfig) { c.DoubleSignCheckHeight = -1 }, true},
|
||||||
}
|
}
|
||||||
|
|
||||||
for desc, tc := range testcases {
|
for desc, tc := range testcases {
|
||||||
tc := tc // appease linter
|
tc := tc // appease linter
|
||||||
t.Run(desc, func(t *testing.T) {
|
t.Run(desc, func(t *testing.T) {
|
||||||
|
|||||||
@@ -422,7 +422,7 @@ func TestByzantineConflictingProposalsWithPartition(t *testing.T) {
|
|||||||
// wait for someone in the big partition (B) to make a block
|
// wait for someone in the big partition (B) to make a block
|
||||||
<-blocksSubs[ind2].Out()
|
<-blocksSubs[ind2].Out()
|
||||||
|
|
||||||
t.Log("A block has been committed. Healing partition")
|
t.Logf("A block has been committed. Healing partition")
|
||||||
p2p.Connect2Switches(switches, ind0, ind1)
|
p2p.Connect2Switches(switches, ind0, ind1)
|
||||||
p2p.Connect2Switches(switches, ind0, ind2)
|
p2p.Connect2Switches(switches, ind0, ind2)
|
||||||
|
|
||||||
|
|||||||
@@ -691,7 +691,7 @@ func capture() {
|
|||||||
// Ensure basic validation of structs is functioning
|
// Ensure basic validation of structs is functioning
|
||||||
|
|
||||||
func TestNewRoundStepMessageValidateBasic(t *testing.T) {
|
func TestNewRoundStepMessageValidateBasic(t *testing.T) {
|
||||||
testCases := []struct { // nolint: maligned
|
testCases := []struct {
|
||||||
expectErr bool
|
expectErr bool
|
||||||
messageRound int32
|
messageRound int32
|
||||||
messageLastCommitRound int32
|
messageLastCommitRound int32
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ func TestSmall(t *testing.T) {
|
|||||||
|
|
||||||
// This test is quite hacky because it relies on SetFinalizer
|
// This test is quite hacky because it relies on SetFinalizer
|
||||||
// which isn't guaranteed to run at all.
|
// which isn't guaranteed to run at all.
|
||||||
//
|
|
||||||
//nolint:unused,deadcode
|
//nolint:unused,deadcode
|
||||||
func _TestGCFifo(t *testing.T) {
|
func _TestGCFifo(t *testing.T) {
|
||||||
if runtime.GOARCH != "amd64" {
|
if runtime.GOARCH != "amd64" {
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ func (s *Subscription) Out() <-chan Message {
|
|||||||
return s.out
|
return s.out
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint: misspell
|
|
||||||
// Cancelled returns a channel that's closed when the subscription is
|
// Cancelled returns a channel that's closed when the subscription is
|
||||||
// terminated and supposed to be used in a select statement.
|
// terminated and supposed to be used in a select statement.
|
||||||
func (s *Subscription) Cancelled() <-chan struct{} {
|
func (s *Subscription) Cancelled() <-chan struct{} {
|
||||||
|
|||||||
@@ -529,8 +529,8 @@ func TestTransportMultiplexRejectSelf(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_, err := mt.Accept(peerConfig{})
|
_, err := mt.Accept(peerConfig{})
|
||||||
if err, ok := err.(ErrRejected); ok {
|
if e, ok := err.(ErrRejected); ok {
|
||||||
if !err.IsSelf() {
|
if !e.IsSelf() {
|
||||||
t.Errorf("expected to reject self, got: %v", err)
|
t.Errorf("expected to reject self, got: %v", err)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1663,8 +1663,6 @@ func (valz validatorsByPriority) Swap(i, j int) {
|
|||||||
valz[i], valz[j] = valz[j], valz[i]
|
valz[i], valz[j] = valz[j], valz[i]
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------
|
|
||||||
|
|
||||||
type testValsByVotingPower []testVal
|
type testValsByVotingPower []testVal
|
||||||
|
|
||||||
func (tvals testValsByVotingPower) Len() int {
|
func (tvals testValsByVotingPower) Len() int {
|
||||||
|
|||||||
Reference in New Issue
Block a user