@@ -15,28 +15,34 @@ SHELL = /usr/bin/env bash -o pipefail
1515.SHELLFLAGS = -ec
1616
1717.PHONY : all
18- all : tidy vet fmt lint test
18+ all : tidy vet fmt lint test # # Run the full verification pipeline (tidy, vet, fmt, lint, test).
19+
20+ # #@ Development
1921
2022.PHONY : fmt
21- fmt :
23+ fmt : # # Format Go source files in-place with gofmt.
2224 go fmt ./...
2325
2426.PHONY : lint
25- lint : golangci-lint # # Run golangci linters and ESLint .
27+ lint : golangci-lint # # Run golangci-lint against the whole module .
2628 $(GOLANGCI_LINT ) run
2729
2830.PHONY : tidy
29- tidy :
31+ tidy : # # Sync go.mod and go.sum with the module's imports.
3032 go mod tidy
3133
3234.PHONY : test
33- test :
35+ test : # # Run unit tests under ./pkg/... with the race detector and coverage enabled.
3436 go test -race -cover ./pkg/...
3537
3638.PHONY : vet
37- vet :
39+ vet : # # Run go vet to catch suspicious constructs.
3840 go vet ./...
3941
42+ .PHONY : scan
43+ scan : govulncheck # # Scan the module for known vulnerabilities.
44+ @$(GOVULNCHECK ) ./...
45+
4046# #@ Dependencies
4147
4248# # Location to install dependencies to
@@ -48,17 +54,17 @@ $(LOCALBIN):
4854GOLANGCI_LINT = $(LOCALBIN ) /golangci-lint-$(GOLANGCI_LINT_VERSION )
4955GOVULNCHECK ?= $(LOCALBIN ) /govulncheck
5056
57+ # Pinned version of golangci-lint; bump here to upgrade the linter across CI and local runs.
5158GOLANGCI_LINT_VERSION ?= v2.11.4
5259.PHONY : golangci-lint
5360golangci-lint : $(GOLANGCI_LINT ) # # Download golangci-lint locally if necessary.
5461$(GOLANGCI_LINT ) : $(LOCALBIN )
5562 $(call go-install-tool,$(GOLANGCI_LINT ) ,github.com/golangci/golangci-lint/v2/cmd/golangci-lint,$(GOLANGCI_LINT_VERSION ) )
5663
5764.PHONY : govulncheck
58- govulncheck : $(GOVULNCHECK ) # # Run govulncheck.
65+ govulncheck : $(GOVULNCHECK ) # # Install govulncheck locally if necessary .
5966$(GOVULNCHECK ) : $(LOCALBIN )
6067 $(call go-install-tool,$(GOVULNCHECK ) ,golang.org/x/vuln/cmd/govulncheck,latest)
61- @$(GOVULNCHECK ) ./...
6268
6369# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
6470# $1 - target path with name of binary (ideally with version)
0 commit comments