Skip to content

Commit

Permalink
Upgrade golangci-lint to v1.50.1 (#505)
Browse files Browse the repository at this point in the history
* Upgrade golangci-lint to v1.50.1

* Backport lint.yml: tendermint/tendermint@83b7f4a
  • Loading branch information
tnasu authored Nov 24, 2022
1 parent 2828a22 commit e6f57a1
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 93 deletions.
20 changes: 14 additions & 6 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
name: Lint
# Lint runs golangci-lint over the entire Ostracon repository
# This workflow is run on every pull request and push to master
# The `golangci` job will pass without running if no *.{go, mod, sum} files have been modified.
name: Golang Linter
# Lint runs golangci-lint over the entire Ostracon repository.
#
# This workflow is run on every pull request and push to main.
#
# The `golangci` job will pass without running if no *.{go, mod, sum}
# files have been modified.
#
# To run this locally, simply run `make lint` from the root of the repo.

on:
pull_request:
push:
Expand All @@ -11,6 +17,9 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 8
steps:
- uses: actions/setup-go@v3
with:
go-version: '1.18'
- uses: actions/checkout@v3
- uses: technote-space/[email protected]
with:
Expand All @@ -20,8 +29,7 @@ jobs:
go.sum
- uses: golangci/[email protected]
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.42.1
version: v1.50.1
args: --timeout 10m
github-token: ${{ secrets.github_token }}
if: env.GIT_DIFF
62 changes: 0 additions & 62 deletions .golangci.yml

This file was deleted.

4 changes: 2 additions & 2 deletions consensus/byzantine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -461,8 +461,8 @@ func TestByzantineConflictingProposalsWithPartition(t *testing.T) {
case <-done:
case <-tick.C:
for i, reactor := range reactors {
t.Log(fmt.Sprintf("Consensus Reactor %v", i))
t.Log(fmt.Sprintf("%v", reactor))
t.Logf("Consensus Reactor %v", i)
t.Logf("%v", reactor)
}
t.Fatalf("Timed out waiting for all validators to commit first block")
}
Expand Down
4 changes: 2 additions & 2 deletions crypto/bls/bls_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ func generatePubKeysAndSigns(t *testing.T, size int) ([]bls.PubKey, [][]byte, []
msgs[i] = []byte(fmt.Sprintf("hello, workd #%d", i))
sigs[i], err = privKey.Sign(msgs[i])
if err != nil {
t.Fatal(fmt.Sprintf("fail to sign: %s", err))
t.Fatalf("fail to sign: %s", err)
}
if !pubKeys[i].VerifySignature(msgs[i], sigs[i]) {
t.Fatal("fail to verify signature")
Expand All @@ -203,7 +203,7 @@ func blsPublicKey(t *testing.T, pubKey crypto.PubKey) bls.PubKey {
} else {
keyType = t.Name()
}
t.Fatal(fmt.Sprintf("specified public key is not for BLS: %s", keyType))
t.Fatalf("specified public key is not for BLS: %s", keyType)
}
return blsPubKey
}
Expand Down
42 changes: 21 additions & 21 deletions p2p/transport_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ func TestTransportMultiplexConnFilter(t *testing.T) {
}

_, err = mt.Accept(peerConfig{})
if err, ok := err.(ErrRejected); ok {
if !err.IsFiltered() {
t.Errorf("expected peer to be filtered, got %v", err)
if e, ok := err.(ErrRejected); ok {
if !e.IsFiltered() {
t.Errorf("expected peer to be filtered, got %v", e)
}
} else {
t.Errorf("expected ErrRejected, got %v", err)
Expand Down Expand Up @@ -387,9 +387,9 @@ func TestTransportMultiplexValidateNodeInfo(t *testing.T) {
}

_, err := mt.Accept(peerConfig{})
if err, ok := err.(ErrRejected); ok {
if !err.IsNodeInfoInvalid() {
t.Errorf("expected NodeInfo to be invalid, got %v", err)
if e, ok := err.(ErrRejected); ok {
if !e.IsNodeInfoInvalid() {
t.Errorf("expected NodeInfo to be invalid, got %v", e)
}
} else {
t.Errorf("expected ErrRejected, got %v", err)
Expand Down Expand Up @@ -426,9 +426,9 @@ func TestTransportMultiplexRejectMissmatchID(t *testing.T) {
}

_, err := mt.Accept(peerConfig{})
if err, ok := err.(ErrRejected); ok {
if !err.IsAuthFailure() {
t.Errorf("expected auth failure, got %v", err)
if e, ok := err.(ErrRejected); ok {
if !e.IsAuthFailure() {
t.Errorf("expected auth failure, got %v", e)
}
} else {
t.Errorf("expected ErrRejected, got %v", err)
Expand All @@ -454,8 +454,8 @@ func TestTransportMultiplexDialRejectWrongID(t *testing.T) {
_, err := dialer.Dial(*addr, peerConfig{})
if err != nil {
t.Logf("connection failed: %v", err)
if err, ok := err.(ErrRejected); ok {
if !err.IsAuthFailure() {
if e, ok := err.(ErrRejected); ok {
if !e.IsAuthFailure() {
t.Errorf("expected auth failure, got %v", err)
}
} else {
Expand Down Expand Up @@ -491,9 +491,9 @@ func TestTransportMultiplexRejectIncompatible(t *testing.T) {
}()

_, err := mt.Accept(peerConfig{})
if err, ok := err.(ErrRejected); ok {
if !err.IsIncompatible() {
t.Errorf("expected to reject incompatible, got %v", err)
if e, ok := err.(ErrRejected); ok {
if !e.IsIncompatible() {
t.Errorf("expected to reject incompatible, got %v", e)
}
} else {
t.Errorf("expected ErrRejected, got %v", err)
Expand All @@ -518,9 +518,9 @@ func TestTransportMultiplexRejectSelf(t *testing.T) {
}()

if err := <-errc; err != nil {
if err, ok := err.(ErrRejected); ok {
if !err.IsSelf() {
t.Errorf("expected to reject self, got: %v", err)
if e, ok := err.(ErrRejected); ok {
if !e.IsSelf() {
t.Errorf("expected to reject self, got: %v", e)
}
} else {
t.Errorf("expected ErrRejected, got %v", err)
Expand All @@ -530,12 +530,12 @@ func TestTransportMultiplexRejectSelf(t *testing.T) {
}

_, err := mt.Accept(peerConfig{})
if err, ok := err.(ErrRejected); ok {
if !err.IsSelf() {
t.Errorf("expected to reject self, got: %v", err)
if e, ok := err.(ErrRejected); ok {
if !e.IsSelf() {
t.Errorf("expected to reject self, got: %v", e)
}
} else {
t.Errorf("expected ErrRejected, got %v", nil)
t.Errorf("expected ErrRejected, got %v", err)
}
}

Expand Down

0 comments on commit e6f57a1

Please sign in to comment.