Browse Source

lint: cleanup branch lint errors (#7238)

pull/7242/head
Sam Kleinman 3 years ago
committed by GitHub
parent
commit
003d15fa4b
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 25 additions and 17 deletions
  1. +1
    -1
      .golangci.yml
  2. +1
    -0
      crypto/secp256k1/secp256k1_nocgo.go
  3. +1
    -0
      internal/consensus/wal_fuzz.go
  4. +1
    -0
      internal/libs/sync/deadlock.go
  5. +1
    -0
      internal/libs/sync/sync.go
  6. +1
    -1
      internal/mempool/ids.go
  7. +1
    -0
      internal/p2p/conn/conn_go110.go
  8. +1
    -0
      internal/p2p/conn/conn_notgo110.go
  9. +2
    -2
      internal/state/state.go
  10. +1
    -1
      internal/state/state_test.go
  11. +1
    -1
      internal/state/store.go
  12. +2
    -2
      internal/state/validation_test.go
  13. +1
    -1
      internal/statesync/reactor.go
  14. +2
    -2
      internal/store/store.go
  15. +1
    -1
      node/node_test.go
  16. +1
    -0
      rpc/jsonrpc/client/integration_test.go
  17. +1
    -0
      tools/tools.go
  18. +5
    -5
      types/validation.go

+ 1
- 1
.golangci.yml View File

@ -33,7 +33,7 @@ linters:
- staticcheck - staticcheck
- structcheck - structcheck
- stylecheck - stylecheck
- typecheck
# - typecheck
- unconvert - unconvert
# - unparam # - unparam
- unused - unused


+ 1
- 0
crypto/secp256k1/secp256k1_nocgo.go View File

@ -1,3 +1,4 @@
//go:build !libsecp256k1
// +build !libsecp256k1 // +build !libsecp256k1
package secp256k1 package secp256k1


+ 1
- 0
internal/consensus/wal_fuzz.go View File

@ -1,3 +1,4 @@
//go:build gofuzz
// +build gofuzz // +build gofuzz
package consensus package consensus


+ 1
- 0
internal/libs/sync/deadlock.go View File

@ -1,3 +1,4 @@
//go:build deadlock
// +build deadlock // +build deadlock
package sync package sync


+ 1
- 0
internal/libs/sync/sync.go View File

@ -1,3 +1,4 @@
//go:build !deadlock
// +build !deadlock // +build !deadlock
package sync package sync


+ 1
- 1
internal/mempool/ids.go View File

@ -7,7 +7,7 @@ import (
"github.com/tendermint/tendermint/types" "github.com/tendermint/tendermint/types"
) )
// nolint: golint
// nolint: revive
// TODO: Rename type. // TODO: Rename type.
type MempoolIDs struct { type MempoolIDs struct {
mtx tmsync.RWMutex mtx tmsync.RWMutex


+ 1
- 0
internal/p2p/conn/conn_go110.go View File

@ -1,3 +1,4 @@
//go:build go1.10
// +build go1.10 // +build go1.10
package conn package conn


+ 1
- 0
internal/p2p/conn/conn_notgo110.go View File

@ -1,3 +1,4 @@
//go:build !go1.10
// +build !go1.10 // +build !go1.10
package conn package conn


+ 2
- 2
internal/state/state.go View File

@ -195,8 +195,8 @@ func (state *State) ToProto() (*tmstate.State, error) {
return sm, nil return sm, nil
} }
// StateFromProto takes a state proto message & returns the local state type
func StateFromProto(pb *tmstate.State) (*State, error) { //nolint:golint
// FromProto takes a state proto message & returns the local state type
func FromProto(pb *tmstate.State) (*State, error) { //nolint:golint
if pb == nil { if pb == nil {
return nil, errors.New("nil State") return nil, errors.New("nil State")
} }


+ 1
- 1
internal/state/state_test.go View File

@ -1081,7 +1081,7 @@ func TestStateProto(t *testing.T) {
assert.NoError(t, err, tt.testName) assert.NoError(t, err, tt.testName)
} }
smt, err := sm.StateFromProto(pbs)
smt, err := sm.FromProto(pbs)
if tt.expPass2 { if tt.expPass2 {
require.NoError(t, err, tt.testName) require.NoError(t, err, tt.testName)
require.Equal(t, tt.state, smt, tt.testName) require.Equal(t, tt.state, smt, tt.testName)


+ 1
- 1
internal/state/store.go View File

@ -130,7 +130,7 @@ func (store dbStore) loadState(key []byte) (state State, err error) {
%v\n`, err)) %v\n`, err))
} }
sm, err := StateFromProto(sp)
sm, err := FromProto(sp)
if err != nil { if err != nil {
return state, err return state, err
} }


+ 2
- 2
internal/state/validation_test.go View File

@ -270,7 +270,7 @@ func TestValidateBlockEvidence(t *testing.T) {
A block with too much evidence fails A block with too much evidence fails
*/ */
evidence := make([]types.Evidence, 0) evidence := make([]types.Evidence, 0)
var currentBytes int64 = 0
var currentBytes int64
// more bytes than the maximum allowed for evidence // more bytes than the maximum allowed for evidence
for currentBytes <= maxBytesEvidence { for currentBytes <= maxBytesEvidence {
newEv := types.NewMockDuplicateVoteEvidenceWithValidator(height, time.Now(), newEv := types.NewMockDuplicateVoteEvidenceWithValidator(height, time.Now(),
@ -290,7 +290,7 @@ func TestValidateBlockEvidence(t *testing.T) {
A good block with several pieces of good evidence passes A good block with several pieces of good evidence passes
*/ */
evidence := make([]types.Evidence, 0) evidence := make([]types.Evidence, 0)
var currentBytes int64 = 0
var currentBytes int64
// precisely the amount of allowed evidence // precisely the amount of allowed evidence
for { for {
newEv := types.NewMockDuplicateVoteEvidenceWithValidator(height, defaultEvidenceTime, newEv := types.NewMockDuplicateVoteEvidenceWithValidator(height, defaultEvidenceTime,


+ 1
- 1
internal/statesync/reactor.go View File

@ -734,7 +734,7 @@ func (r *Reactor) handleLightBlockMessage(envelope p2p.Envelope) error {
} }
case *ssproto.LightBlockResponse: case *ssproto.LightBlockResponse:
var height int64 = 0
var height int64
if msg.LightBlock != nil { if msg.LightBlock != nil {
height = msg.LightBlock.SignedHeader.Header.Height height = msg.LightBlock.SignedHeader.Header.Height
} }


+ 2
- 2
internal/store/store.go View File

@ -345,7 +345,7 @@ func (bs *BlockStore) pruneRange(
var ( var (
err error err error
pruned uint64 pruned uint64
totalPruned uint64 = 0
totalPruned uint64
) )
batch := bs.db.NewBatch() batch := bs.db.NewBatch()
@ -392,7 +392,7 @@ func (bs *BlockStore) batchDelete(
start, end []byte, start, end []byte,
preDeletionHook func(key, value []byte, batch dbm.Batch) error, preDeletionHook func(key, value []byte, batch dbm.Batch) error,
) (uint64, []byte, error) { ) (uint64, []byte, error) {
var pruned uint64 = 0
var pruned uint64
iter, err := bs.db.Iterator(start, end) iter, err := bs.db.Iterator(start, end)
if err != nil { if err != nil {
return pruned, start, err return pruned, start, err


+ 1
- 1
node/node_test.go View File

@ -257,7 +257,7 @@ func TestCreateProposalBlock(t *testing.T) {
// fill the evidence pool with more evidence // fill the evidence pool with more evidence
// than can fit in a block // than can fit in a block
var currentBytes int64 = 0
var currentBytes int64
for currentBytes <= maxEvidenceBytes { for currentBytes <= maxEvidenceBytes {
ev := types.NewMockDuplicateVoteEvidenceWithValidator(height, time.Now(), privVals[0], "test-chain") ev := types.NewMockDuplicateVoteEvidenceWithValidator(height, time.Now(), privVals[0], "test-chain")
currentBytes += int64(len(ev.Bytes())) currentBytes += int64(len(ev.Bytes()))


+ 1
- 0
rpc/jsonrpc/client/integration_test.go View File

@ -1,3 +1,4 @@
//go:build release
// +build release // +build release
// The code in here is comprehensive as an integration // The code in here is comprehensive as an integration


+ 1
- 0
tools/tools.go View File

@ -1,3 +1,4 @@
//go:build tools
// +build tools // +build tools
// This file uses the recommended method for tracking developer tools in a go module. // This file uses the recommended method for tracking developer tools in a go module.


+ 5
- 5
types/validation.go View File

@ -162,9 +162,9 @@ func verifyCommitBatch(
var ( var (
val *Validator val *Validator
valIdx int32 valIdx int32
seenVals = make(map[int32]int, len(commit.Signatures))
batchSigIdxs = make([]int, 0, len(commit.Signatures))
talliedVotingPower int64 = 0
seenVals = make(map[int32]int, len(commit.Signatures))
batchSigIdxs = make([]int, 0, len(commit.Signatures))
talliedVotingPower int64
) )
// attempt to create a batch verifier // attempt to create a batch verifier
bv, ok := batch.CreateBatchVerifier(vals.GetProposer().PubKey) bv, ok := batch.CreateBatchVerifier(vals.GetProposer().PubKey)
@ -275,8 +275,8 @@ func verifyCommitSingle(
var ( var (
val *Validator val *Validator
valIdx int32 valIdx int32
seenVals = make(map[int32]int, len(commit.Signatures))
talliedVotingPower int64 = 0
seenVals = make(map[int32]int, len(commit.Signatures))
talliedVotingPower int64
voteSignBytes []byte voteSignBytes []byte
) )
for idx, commitSig := range commit.Signatures { for idx, commitSig := range commit.Signatures {


Loading…
Cancel
Save