add golangci-lint to gitlab container

This commit is contained in:
Todd Gruben 2021-10-27 13:35:42 -05:00
parent 84f6a5570f
commit 7e14008ed8
2 changed files with 55 additions and 1 deletions

View file

@ -64,6 +64,24 @@ generate coverage html:
needs:
- job: run go tests
install goci:
stage: build
image: golang:1.16.9
script:
- echo "Installing golangci-lint"
- GO111MODULE=off go get github.com/golangci/golangci-lint/cmd/golangci-lint
artifacts:
paths:
- /go/bin/golangci-lint
run goci:
stage: test
image: golang:1.16.9
script:
- echo "Running golangci-lint"
needs:
- job: install goci
upload to sonarcloud:
stage: test
image: sonarsource/sonar-scanner-cli:4.6
@ -121,4 +139,4 @@ build for darwin arm64:
- go build -o featurebase_darwin_arm64 ./cmd/featurebase
artifacts:
paths:
- featurebase_darwin_arm64
- featurebase_darwin_arm64

View file

@ -1,3 +1,39 @@
run:
#skip the protobuf generated files
skip-dirs:
- pb
- proto
skip-files:
- pql/pql.peg.go
linters-settings:
gofmt:
simplify: true
govet:
# report about shadowed variables
check-shadowing: true
# settings per analyzer
settings:
printf: # analyzer name, run `go tool vet help` to see all analyzers
funcs: # run `go tool vet help printf` to see available settings for `printf` analyzer
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
# enable or disable analyzers by name
# run `go tool vet help` to see all analyzers
enable:
- atomicalign
enable-all: false
disable:
- shadow
disable-all: false
staticcheck:
# Select the Go version to target. The default is '1.13'.
go: "1.16"
# https://staticcheck.io/docs/options#checks
checks: [ "all" ]