Add staticcheck tool
This commit is contained in:
15
Makefile
15
Makefile
@@ -8,14 +8,15 @@ GOVET := go vet
|
||||
GOIMPORTS := go tool goimports
|
||||
DEADCODE := go tool deadcode
|
||||
GOVULNCHECK := go tool govulncheck
|
||||
STATICCHECK := go tool staticcheck
|
||||
BIOME := biome
|
||||
|
||||
BUILDFLAGS := -buildvcs=true
|
||||
PLATFORMS := linux/amd64
|
||||
|
||||
.PHONY: all build build-all buildinfo check clean deadcode deps fmt help \
|
||||
imports install lint run test tidy tools uninstall verify vet \
|
||||
vulncheck $(CMDS)
|
||||
imports install lint run staticcheck test tidy tools uninstall \
|
||||
verify vet vulncheck $(CMDS)
|
||||
|
||||
## Build all binaries (default target)
|
||||
all: build
|
||||
@@ -67,7 +68,7 @@ test:
|
||||
$(GO) test -cover -race ./...
|
||||
|
||||
## Run all linters (fmt, vet, imports, deadcode, vulncheck)
|
||||
lint: fmt vet imports deadcode vulncheck biome
|
||||
lint: fmt vet imports deadcode vulncheck staticcheck biome
|
||||
|
||||
## Format code using go fmt
|
||||
fmt:
|
||||
@@ -75,7 +76,8 @@ fmt:
|
||||
|
||||
## Fix imports and format using goimports
|
||||
imports:
|
||||
$(GOIMPORTS) -w -local "$(MODULE)" .
|
||||
find . -type f -name '*.go' -not -path './vendor/*' | \
|
||||
xargs $(GOIMPORTS) -w -local "$(MODULE)"
|
||||
|
||||
## Run go vet
|
||||
vet:
|
||||
@@ -96,6 +98,10 @@ check: lint
|
||||
tidy:
|
||||
$(GO) mod tidy
|
||||
|
||||
## Run staticcheck
|
||||
staticcheck:
|
||||
$(STATICCHECK) ./...
|
||||
|
||||
## Download dependencies
|
||||
deps:
|
||||
$(GO) mod download
|
||||
@@ -109,6 +115,7 @@ tools:
|
||||
go get -tool golang.org/x/tools/cmd/deadcode@latest
|
||||
go get -tool golang.org/x/tools/cmd/goimports@latest
|
||||
go get -tool golang.org/x/vuln/cmd/govulncheck@latest
|
||||
go get -tool honnef.co/go/tools/cmd/staticcheck@latest
|
||||
|
||||
## Run the specified CMD binary (use ARGS="..." to pass arguments)
|
||||
# trap '' INT prevents colorize-logs from exiting immediately on Ctrl-C,
|
||||
|
||||
Reference in New Issue
Block a user