mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
Lint and errcheck using golangci-lint (#3558)
This commit is contained in:
parent
01bc0c94ab
commit
ec2c82e800
2 changed files with 17 additions and 16 deletions
15
.golangci.yml
Normal file
15
.golangci.yml
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
run:
|
||||||
|
timeout: 2m
|
||||||
|
|
||||||
|
enable:
|
||||||
|
- revive
|
||||||
|
|
||||||
|
issues:
|
||||||
|
exclude-rules:
|
||||||
|
- linters:
|
||||||
|
- staticcheck
|
||||||
|
text: "SA(4003|1019|5011):"
|
||||||
|
|
||||||
|
linters-settings:
|
||||||
|
errcheck:
|
||||||
|
exclude: ./errcheck_excludes.txt
|
18
Makefile
18
Makefile
|
@ -315,21 +315,7 @@ vet:
|
||||||
go vet ./lib/...
|
go vet ./lib/...
|
||||||
go vet ./app/...
|
go vet ./app/...
|
||||||
|
|
||||||
lint: install-golint
|
check-all: fmt vet golangci-lint govulncheck
|
||||||
golint lib/...
|
|
||||||
golint app/...
|
|
||||||
|
|
||||||
install-golint:
|
|
||||||
which golint || go install golang.org/x/lint/golint@latest
|
|
||||||
|
|
||||||
errcheck: install-errcheck
|
|
||||||
errcheck -exclude=errcheck_excludes.txt ./lib/...
|
|
||||||
errcheck -exclude=errcheck_excludes.txt ./app/...
|
|
||||||
|
|
||||||
install-errcheck:
|
|
||||||
which errcheck || go install github.com/kisielk/errcheck@latest
|
|
||||||
|
|
||||||
check-all: fmt vet lint errcheck golangci-lint govulncheck
|
|
||||||
|
|
||||||
test:
|
test:
|
||||||
go test ./lib/... ./app/...
|
go test ./lib/... ./app/...
|
||||||
|
@ -380,7 +366,7 @@ install-qtc:
|
||||||
|
|
||||||
|
|
||||||
golangci-lint: install-golangci-lint
|
golangci-lint: install-golangci-lint
|
||||||
golangci-lint run --exclude '(SA4003|SA1019|SA5011):' -D errcheck -D structcheck --timeout 2m
|
golangci-lint run
|
||||||
|
|
||||||
install-golangci-lint:
|
install-golangci-lint:
|
||||||
which golangci-lint || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell go env GOPATH)/bin v1.50.1
|
which golangci-lint || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell go env GOPATH)/bin v1.50.1
|
||||||
|
|
Loading…
Reference in a new issue