diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e684a45c..fe7c3a05 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,7 +7,7 @@ on: jobs: build: runs-on: ubuntu-latest - container: golangci/golangci-lint:v1.55.2 + container: golangci/golangci-lint:v1.56.0 steps: - uses: actions/cache@v2 with: diff --git a/.golangci.yml b/.golangci.yml index 798f7e76..92bf950b 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -83,6 +83,8 @@ linters: - godox # Disabled until we implement some error types and migrate to use them. - goerr113 + # We don't really care about sprintf performance. + - perfsprint # To allow defensive approach when initializing structs. - ireturn # Disabled until tests are split and moved to the right file names. @@ -154,7 +156,6 @@ linters: - nonamedreturns - nosprintfhostport - paralleltest - - perfsprint - prealloc - predeclared - promlinter @@ -163,6 +164,7 @@ linters: - revive - rowserrcheck - sloglint + - spancheck - sqlclosecheck - stylecheck - tagalign diff --git a/Makefile b/Makefile index f99fdd4e..2acf1745 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ GORUN=$(GOCMD) run GOBUILD=$(GOCMD) build -v -ldflags $(LD_FLAGS) -trimpath CC_TEST_REPORTER_ID=6e107e510c5479f40b0ce9166a254f3f1ee0bc547b3e48281bada1a5a32bb56d -GOLANGCI_LINT_VERSION=v1.55.2 +GOLANGCI_LINT_VERSION=v1.56.0 BIN_PATH=$$HOME/bin GO_PACKAGES=./... diff --git a/pkg/etcd/member_test.go b/pkg/etcd/member_test.go index ff1c7712..d85e51fe 100644 --- a/pkg/etcd/member_test.go +++ b/pkg/etcd/member_test.go @@ -159,8 +159,8 @@ func TestValidate(t *testing.T) { t.Parallel() m := testCase.mutator(validMember(t)) - err := m.Validate() + err := m.Validate() if testCase.expectError && err == nil { t.Fatalf("Expected error") } diff --git a/pkg/host/host_test.go b/pkg/host/host_test.go index 0689f15e..bb878748 100644 --- a/pkg/host/host_test.go +++ b/pkg/host/host_test.go @@ -75,6 +75,7 @@ func TestValidate(t *testing.T) { if testCase.Error && err == nil { t.Fatalf(testCase.Message) } + if !testCase.Error && err != nil { t.Errorf(testCase.Message) } diff --git a/pkg/host/transport/ssh/ssh_test.go b/pkg/host/transport/ssh/ssh_test.go index 1091e9f0..5a7d1794 100644 --- a/pkg/host/transport/ssh/ssh_test.go +++ b/pkg/host/transport/ssh/ssh_test.go @@ -683,8 +683,6 @@ func TestNewBadSSHAgentEnv(t *testing.T) { } } -//nolint:paralleltest // This test may access SSHAuthSockEnv environment variable, -//nolint:paralleltest // which is a global variable, so to keep things stable, don't run it in parallel. func TestNewSSHAgent(t *testing.T) { agentKeyring := agent.NewKeyring() @@ -729,8 +727,6 @@ func TestNewSSHAgent(t *testing.T) { } } -//nolint:paralleltest // This test may access SSHAuthSockEnv environment variable, -//nolint:paralleltest // which is a global variable, so to keep things stable, don't run it in parallel. func TestNewSSHAgentWrongSocket(t *testing.T) { addr := &net.UnixAddr{ Name: "@bar", diff --git a/pkg/pki/privatekey_test.go b/pkg/pki/privatekey_test.go index f0cc8afc..b809bbb4 100644 --- a/pkg/pki/privatekey_test.go +++ b/pkg/pki/privatekey_test.go @@ -47,7 +47,6 @@ aHR0cHM6Ly93d3cueW91dHViZS5jb20vd2F0Y2g/dj1kUXc0dzlXZ1hjUQo= t.Parallel() err := pki.ValidatePrivateKey(testCase.key) - if testCase.err && err == nil { t.Fatalf("Expected error and didn't get any.") } diff --git a/pkg/types/certificate_test.go b/pkg/types/certificate_test.go index 36bab70b..53f741bb 100644 --- a/pkg/types/certificate_test.go +++ b/pkg/types/certificate_test.go @@ -42,7 +42,6 @@ func TestCertificateParse(t *testing.T) { bar := &Foo{} err := yaml.Unmarshal([]byte(testCase.YAML), bar) - if testCase.Error && err == nil { t.Fatalf("Expected error and didn't get any.") } diff --git a/pkg/types/privatekey_test.go b/pkg/types/privatekey_test.go index 1989894b..f27d7b82 100644 --- a/pkg/types/privatekey_test.go +++ b/pkg/types/privatekey_test.go @@ -42,7 +42,6 @@ func TestPrivateKeyParse(t *testing.T) { bar := &Foo{} err := yaml.Unmarshal([]byte(testCase.YAML), bar) - if testCase.Error && err == nil { t.Fatalf("Expected error and didn't get any.") }