Skip to content

Commit dfc7446

Browse files
rolinhtklauser
authored andcommitted
ci: use golangci-lint for static checks
Signed-off-by: Robin Hahling <[email protected]>
1 parent f3aa07d commit dfc7446

File tree

2 files changed

+62
-11
lines changed

2 files changed

+62
-11
lines changed

.github/workflows/tests.yml

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,15 @@ jobs:
2323
go-version: ${{ matrix.go-version }}
2424
- name: Checkout code
2525
uses: actions/checkout@v2
26-
- name: Format
27-
if: matrix.go-version >= '1.17'
28-
run: diff -u <(echo -n) <(gofmt -d .)
26+
- name: Run static checks
27+
uses: golangci/golangci-lint-action@v2
28+
with:
29+
version: v1.42.1
30+
args: --config=.golangci.yml --verbose
31+
skip-go-installation: true
32+
skip-pkg-cache: true
33+
skip-build-cache: true
2934
- name: Build
3035
run: go build
31-
- name: Vet
32-
run: go vet
33-
- name: Install and run staticcheck
34-
if: matrix.go-version >= '1.17'
35-
run: |
36-
go install honnef.co/go/tools/cmd/staticcheck@latest
37-
staticcheck -version
38-
staticcheck -- ./...
3936
- name: Run unit tests
4037
run: go test -v -race -cover

.golangci.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# See https://golangci-lint.run/usage/configuration/ for available options.
2+
# Also https://github.com/cilium/cilium/blob/master/.golangci.yaml as a
3+
# reference.
4+
linters:
5+
disable-all: true
6+
enable:
7+
- asciicheck
8+
- deadcode
9+
- dogsled
10+
- durationcheck
11+
- errcheck
12+
- errname
13+
- errorlint
14+
- exhaustive
15+
- exportloopref
16+
- forcetypeassert
17+
- godot
18+
- goerr113
19+
- gofmt
20+
- goimports
21+
- gosec
22+
- gosimple
23+
- govet
24+
- ifshort
25+
- ineffassign
26+
- misspell
27+
- nestif
28+
- nilerr
29+
- prealloc
30+
- predeclared
31+
- revive
32+
- rowserrcheck
33+
- staticcheck
34+
- structcheck
35+
- thelper
36+
- typecheck
37+
- unconvert
38+
- unparam
39+
- unused
40+
- varcheck
41+
42+
linters-settings:
43+
gosimple:
44+
go: "1.17"
45+
govet:
46+
enable-all: true
47+
disable:
48+
- fieldalignment
49+
staticcheck:
50+
go: "1.17"
51+
stylecheck:
52+
go: "1.17"
53+
unused:
54+
go: "1.17"

0 commit comments

Comments
 (0)