chore: add golangci config

main
sudo pacman -Syu 2022-07-03 21:34:46 +07:00 committed by sudo pacman -Syu
parent b99e4d1947
commit 3c72e5b206
2 changed files with 77 additions and 2 deletions

74
.golangci.yml Normal file
View File

@ -0,0 +1,74 @@
run:
tests: false
skip-dirs:
- ".*test.*"
- ".*mock.*"
- ".*generated.*"
- ".*example.*"
skip-files:
- ".*Mock.*"
- ".*_mock.*"
- ".*_generated.*"
go: "1.18"
output:
sort-results: true
linters:
disable-all: true
enable:
- deadcode
- errcheck
- gosimple
- govet
- staticcheck
- typecheck
- unused
- varcheck
- errname
- errorlint
- execinquery
- goerr113
- gofumpt
- gosec
- ifshort
- importas
- makezero
- nilnil
- prealloc
- unconvert
fast: true
linters-settings:
gosec:
excludes:
- G402
- G501
- G505
exclude-generated: true
govet:
check-shadowing: false
disable-all: true
enable:
- assign
- atomic
- bools
- buildtag
- composites
- copylocks
- fieldalignment
- httpresponse
- loopclosure
- lostcancel
- nilfunc
- printf
- unmarshal
- unreachable
- unusedresult
staticcheck:
go: "1.18"
checks: ["all", "-SA1019"]
issues:
new: true
fix: true

View File

@ -1,4 +1,6 @@
.PHONY: test coverage-cli coverate-html lint
.PHONY: all test coverage-cli coverate-html lint
all: test lint
test:
go test -race -coverprofile=coverage.out ./...
@ -11,4 +13,3 @@ coverage-html: test
lint:
golangci-lint run ./...
semgrep --config auto