diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index de3126982..c25fa9395 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -6,7 +6,8 @@ jobs: steps: - uses: actions/checkout@master - name: golangci-lint - uses: reviewdog/action-golangci-lint@v1 + uses: reviewdog/action-golangci-lint@master with: github_token: ${{ secrets.github_token }} reporter: github-pr-review + golangci_lint_flags: "--timeout 30m" diff --git a/.golangci.yml b/.golangci.yml index dc934f43d..6ff2d4b21 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -38,6 +38,7 @@ linters: # - whitespace # - wsl # - gocognit + # - nolintlint disable: - errcheck @@ -46,6 +47,7 @@ issues: - linters: - lll source: "https://" + max-same-issues: 50 linters-settings: dogsled: @@ -56,15 +58,7 @@ linters-settings: # check-shadowing: true golint: min-confidence: 0 -# gocyclo: -# min-complexity: 10 -# misspell: -# locale: US -# gocritic: -# enabled-tags: -# - performance -# - style -# - experimental -# disabled-checks: -# - wrapperFunc -# - commentFormatting # https://github.com/go-critic/go-critic/issues/755 + # gocyclo: + # min-complexity: 10 + # misspell: + # locale: US diff --git a/abci/types/application.go b/abci/types/application.go index 51edffbd4..65cc78b8c 100644 --- a/abci/types/application.go +++ b/abci/types/application.go @@ -1,4 +1,4 @@ -package types // nolint: goimports +package types import ( context "golang.org/x/net/context" diff --git a/blockchain/v2/reactor.go b/blockchain/v2/reactor.go index 60c73e6a8..00d919335 100644 --- a/blockchain/v2/reactor.go +++ b/blockchain/v2/reactor.go @@ -149,7 +149,6 @@ type blockVerifier interface { VerifyCommit(chainID string, blockID types.BlockID, height int64, commit *types.Commit) error } -//nolint:deadcode type blockApplier interface { ApplyBlock(state state.State, blockID types.BlockID, block *types.Block) (state.State, int64, error) } diff --git a/blockchain/v2/routine.go b/blockchain/v2/routine.go index ad32e3e82..40e1971fe 100644 --- a/blockchain/v2/routine.go +++ b/blockchain/v2/routine.go @@ -43,7 +43,6 @@ func newRoutine(name string, handleFunc handleFunc, bufferSize int) *Routine { } } -// nolint: unused func (rt *Routine) setLogger(logger log.Logger) { rt.logger = logger } diff --git a/consensus/wal.go b/consensus/wal.go index 7b09ffa2d..13e17bda3 100644 --- a/consensus/wal.go +++ b/consensus/wal.go @@ -392,7 +392,7 @@ func (dec *WALDecoder) Decode() (*TimedWALMessage, error) { return nil, DataCorruptionError{fmt.Errorf("checksums do not match: read: %v, actual: %v", crc, actualCRC)} } - var res = new(TimedWALMessage) // nolint: gosimple + var res = new(TimedWALMessage) err = cdc.UnmarshalBinaryBare(data, res) if err != nil { return nil, DataCorruptionError{fmt.Errorf("failed to decode data: %v", err)} diff --git a/crypto/ed25519/ed25519.go b/crypto/ed25519/ed25519.go index 1ce6f7b11..ff19b93d8 100644 --- a/crypto/ed25519/ed25519.go +++ b/crypto/ed25519/ed25519.go @@ -160,7 +160,6 @@ func (pubKey PubKeyEd25519) String() string { return fmt.Sprintf("PubKeyEd25519{%X}", pubKey[:]) } -// nolint: golint func (pubKey PubKeyEd25519) Equals(other crypto.PubKey) bool { if otherEd, ok := other.(PubKeyEd25519); ok { return bytes.Equal(pubKey[:], otherEd[:]) diff --git a/crypto/merkle/result.go b/crypto/merkle/result.go index c7bbb575f..a17e38e1f 100644 --- a/crypto/merkle/result.go +++ b/crypto/merkle/result.go @@ -1,4 +1,3 @@ -// nolint: dupl package merkle import ( diff --git a/crypto/xchacha20poly1305/xchachapoly.go b/crypto/xchacha20poly1305/xchachapoly.go index c7a175b5f..2578520a5 100644 --- a/crypto/xchacha20poly1305/xchachapoly.go +++ b/crypto/xchacha20poly1305/xchachapoly.go @@ -47,12 +47,10 @@ func New(key []byte) (cipher.AEAD, error) { return ret, nil } -// nolint func (c *xchacha20poly1305) NonceSize() int { return NonceSize } -// nolint func (c *xchacha20poly1305) Overhead() int { return TagSize } diff --git a/libs/kv/result.go b/libs/kv/result.go index fd40450b1..c1a540d53 100644 --- a/libs/kv/result.go +++ b/libs/kv/result.go @@ -1,5 +1,3 @@ -// nolint: dupl -// dupl is reading this as the same file as crypto/merkle/result.go package kv import ( diff --git a/libs/pubsub/query/peg.go b/libs/pubsub/query/peg.go index 3444dab34..816589f02 100644 --- a/libs/pubsub/query/peg.go +++ b/libs/pubsub/query/peg.go @@ -1,4 +1,3 @@ -// nolint package query //go:generate peg -inline -switch query.peg diff --git a/mempool/cache_test.go b/mempool/cache_test.go index 99bbba406..0061fce79 100644 --- a/mempool/cache_test.go +++ b/mempool/cache_test.go @@ -20,7 +20,7 @@ func TestCacheRemove(t *testing.T) { for i := 0; i < numTxs; i++ { // probability of collision is 2**-256 txBytes := make([]byte, 32) - rand.Read(txBytes) // nolint: gosec + rand.Read(txBytes) txs[i] = txBytes cache.Push(txBytes) // make sure its added to both the linked list and the map diff --git a/statesync/snapshots_test.go b/statesync/snapshots_test.go index e512da0b9..ebbb29717 100644 --- a/statesync/snapshots_test.go +++ b/statesync/snapshots_test.go @@ -213,7 +213,6 @@ func TestSnapshotPool_Reject(t *testing.T) { assert.True(t, added) } -// nolint: dupl func TestSnapshotPool_RejectFormat(t *testing.T) { stateProvider := &mocks.StateProvider{} stateProvider.On("AppHash", mock.Anything).Return([]byte("app_hash"), nil) diff --git a/types/block_test.go b/types/block_test.go index f4d283ad2..36eb0b146 100644 --- a/types/block_test.go +++ b/types/block_test.go @@ -173,8 +173,8 @@ func makeBlockIDRandom() BlockID { blockHash = make([]byte, tmhash.Size) partSetHash = make([]byte, tmhash.Size) ) - rand.Read(blockHash) //nolint: gosec - rand.Read(partSetHash) //nolint: gosec + rand.Read(blockHash) + rand.Read(partSetHash) return BlockID{blockHash, PartSetHeader{123, partSetHash}} }