From 7b82f62a13a1501b2042c87de4066dd04a356914 Mon Sep 17 00:00:00 2001 From: Denis Palnitsky Date: Thu, 28 Apr 2022 15:44:33 +0200 Subject: [PATCH] Use staticcheck for linting --- .github/workflows/test.yaml | 18 ++++++++++++------ Makefile | 2 +- cache_test.go | 8 ++++---- tools.go | 2 +- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 092a4a2..8680eae 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -6,9 +6,8 @@ on: push: jobs: - build: - - name: build and test + test: + name: test runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -18,9 +17,6 @@ jobs: with: go-version: 1.18 - - name: lint - uses: golangci/golangci-lint-action@v2 - - name: Test run: go test -v ./... -coverprofile="coverage.out" @@ -32,3 +28,13 @@ jobs: fail_ci_if_error: true # optional (default = false) verbose: false # optional (default = false) + lint: + name: lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 1 + - uses: dominikh/staticcheck-action@v1.1.0 + with: + version: "2022.1.1" \ No newline at end of file diff --git a/Makefile b/Makefile index ca06997..3bca014 100644 --- a/Makefile +++ b/Makefile @@ -4,4 +4,4 @@ test: # Go lint lint: - golangci-lint run \ No newline at end of file + staticcheck ./... \ No newline at end of file diff --git a/cache_test.go b/cache_test.go index 8e1f71b..3d9ed73 100644 --- a/cache_test.go +++ b/cache_test.go @@ -373,7 +373,7 @@ func BenchmarkRWMutexMapGet(b *testing.B) { b.StartTimer() for i := 0; i < b.N; i++ { mu.RLock() - _, _ = m["foo"] + _ = m["foo"] mu.RUnlock() } } @@ -388,7 +388,7 @@ func BenchmarkRWMutexInterfaceMapGetStruct(b *testing.B) { b.StartTimer() for i := 0; i < b.N; i++ { mu.RLock() - _, _ = m[s] + _ = m[s] mu.RUnlock() } } @@ -402,7 +402,7 @@ func BenchmarkRWMutexInterfaceMapGetString(b *testing.B) { b.StartTimer() for i := 0; i < b.N; i++ { mu.RLock() - _, _ = m["foo"] + _ = m["foo"] mu.RUnlock() } } @@ -450,7 +450,7 @@ func BenchmarkRWMutexMapGetConcurrent(b *testing.B) { go func() { for j := 0; j < each; j++ { mu.RLock() - _, _ = m["foo"] + _ = m["foo"] mu.RUnlock() } wg.Done() diff --git a/tools.go b/tools.go index f6d0a8c..0007af0 100644 --- a/tools.go +++ b/tools.go @@ -4,5 +4,5 @@ package tools import ( - _ "github.com/golangci/golangci-lint/cmd/golangci-lint" + _ "honnef.co/go/tools/cmd/staticcheck" )