From 2d167aefcff234de5f85b283aacfd9a8b04c7548 Mon Sep 17 00:00:00 2001 From: Marko Date: Mon, 3 Aug 2020 09:57:06 +0200 Subject: [PATCH] ci: freeze golangci action version (#5196) ## Description This PR updates golang-ci to latest and stops looking at master for the action. Closes: #XXX --- .github/workflows/lint.yaml | 4 ++-- .golangci.yml | 7 +++---- crypto/merkle/proof_key_path_test.go | 2 +- libs/rand/random.go | 2 +- light/client.go | 1 + proxy/client.go | 1 + rpc/jsonrpc/server/http_server_test.go | 2 +- statesync/snapshots.go | 2 +- 8 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index c1f0f5436..0b3e19114 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -20,10 +20,10 @@ jobs: .go .mod .sum - - uses: golangci/golangci-lint-action@master + - uses: golangci/golangci-lint-action@v2.1.0 with: # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. - version: v1.28 + version: v1.30 args: --timeout 10m github-token: ${{ secrets.github_token }} if: "env.GIT_DIFF != ''" diff --git a/.golangci.yml b/.golangci.yml index 1c5fff613..683181678 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -44,6 +44,9 @@ linters: issues: exclude-rules: + - path: _test\.go + linters: + - gosec - linters: - lll source: "https://" @@ -58,7 +61,3 @@ linters-settings: # check-shadowing: true golint: min-confidence: 0 - # gocyclo: - # min-complexity: 10 - # misspell: - # locale: US diff --git a/crypto/merkle/proof_key_path_test.go b/crypto/merkle/proof_key_path_test.go index 34c918f4a..22e3e21ca 100644 --- a/crypto/merkle/proof_key_path_test.go +++ b/crypto/merkle/proof_key_path_test.go @@ -26,7 +26,7 @@ func TestKeyPath(t *testing.T) { keys[i][j] = alphanum[rand.Intn(len(alphanum))] } case KeyEncodingHex: - rand.Read(keys[i]) //nolint: gosec + rand.Read(keys[i]) default: panic("Unexpected encoding") } diff --git a/libs/rand/random.go b/libs/rand/random.go index 687affd4a..b15e2561f 100644 --- a/libs/rand/random.go +++ b/libs/rand/random.go @@ -48,7 +48,7 @@ func (r *Rand) init() { } func (r *Rand) reset(seed int64) { - r.rand = mrand.New(mrand.NewSource(seed)) + r.rand = mrand.New(mrand.NewSource(seed)) // nolint:gosec // G404: Use of weak random number generator } //---------------------------------------- diff --git a/light/client.go b/light/client.go index 319eb582a..ecca44556 100644 --- a/light/client.go +++ b/light/client.go @@ -1309,6 +1309,7 @@ func (c *Client) sendConflictingHeadersEvidence(ev *types.ConflictingHeadersEvid // exponential backoff (with jitter) // 0.5s -> 2s -> 4.5s -> 8s -> 12.5 with 1s variation func backoffTimeout(attempt uint16) time.Duration { + // nolint:gosec // G404: Use of weak random number generator return time.Duration(500*attempt*attempt)*time.Millisecond + time.Duration(rand.Intn(1000))*time.Millisecond } diff --git a/proxy/client.go b/proxy/client.go index 0586dd21d..1dc6d8853 100644 --- a/proxy/client.go +++ b/proxy/client.go @@ -62,6 +62,7 @@ func (r *remoteClientCreator) NewABCIClient() (abcicli.Client, error) { if err != nil { return nil, fmt.Errorf("failed to connect to proxy: %w", err) } + return remoteApp, nil } diff --git a/rpc/jsonrpc/server/http_server_test.go b/rpc/jsonrpc/server/http_server_test.go index 7b5e35873..c93b4b380 100644 --- a/rpc/jsonrpc/server/http_server_test.go +++ b/rpc/jsonrpc/server/http_server_test.go @@ -88,7 +88,7 @@ func TestServeTLS(t *testing.T) { go ServeTLS(ln, mux, "test.crt", "test.key", log.TestingLogger(), DefaultConfig()) tr := &http.Transport{ - TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, // nolint: gosec + TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, } c := &http.Client{Transport: tr} res, err := c.Get("https://" + ln.Addr().String()) diff --git a/statesync/snapshots.go b/statesync/snapshots.go index c9ee4cd46..9042368e4 100644 --- a/statesync/snapshots.go +++ b/statesync/snapshots.go @@ -140,7 +140,7 @@ func (p *snapshotPool) GetPeer(snapshot *snapshot) p2p.Peer { if len(peers) == 0 { return nil } - return peers[rand.Intn(len(peers))] + return peers[rand.Intn(len(peers))] // nolint:gosec // G404: Use of weak random number generator } // GetPeers returns the peers for a snapshot.