Skip to content

Commit

Permalink
ci: use golangci-lint for static checks
Browse files Browse the repository at this point in the history
Signed-off-by: Robin Hahling <[email protected]>
  • Loading branch information
rolinh authored and tklauser committed Sep 14, 2021
1 parent f3aa07d commit dfc7446
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 11 deletions.
19 changes: 8 additions & 11 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,15 @@ jobs:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v2
- name: Format
if: matrix.go-version >= '1.17'
run: diff -u <(echo -n) <(gofmt -d .)
- name: Run static checks
uses: golangci/golangci-lint-action@v2
with:
version: v1.42.1
args: --config=.golangci.yml --verbose
skip-go-installation: true
skip-pkg-cache: true
skip-build-cache: true
- name: Build
run: go build
- name: Vet
run: go vet
- name: Install and run staticcheck
if: matrix.go-version >= '1.17'
run: |
go install honnef.co/go/tools/cmd/staticcheck@latest
staticcheck -version
staticcheck -- ./...
- name: Run unit tests
run: go test -v -race -cover
54 changes: 54 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# See https://golangci-lint.run/usage/configuration/ for available options.
# Also https://github.com/cilium/cilium/blob/master/.golangci.yaml as a
# reference.
linters:
disable-all: true
enable:
- asciicheck
- deadcode
- dogsled
- durationcheck
- errcheck
- errname
- errorlint
- exhaustive
- exportloopref
- forcetypeassert
- godot
- goerr113
- gofmt
- goimports
- gosec
- gosimple
- govet
- ifshort
- ineffassign
- misspell
- nestif
- nilerr
- prealloc
- predeclared
- revive
- rowserrcheck
- staticcheck
- structcheck
- thelper
- typecheck
- unconvert
- unparam
- unused
- varcheck

linters-settings:
gosimple:
go: "1.17"
govet:
enable-all: true
disable:
- fieldalignment
staticcheck:
go: "1.17"
stylecheck:
go: "1.17"
unused:
go: "1.17"

0 comments on commit dfc7446

Please sign in to comment.