|
1 | | -.PHONY: all build deps image migrate test vet sec vulncheck format hooks lint unused release |
| 1 | +.PHONY: all build deps image migrate test sec vulncheck format hooks lint unused release golangci-lint |
2 | 2 | .PHONY: check-gosec check-govulncheck check-oapi-codegen check-staticcheck check-go-version check-format |
3 | 3 | CHECK_FILES ?= ./... |
4 | 4 |
|
@@ -33,15 +33,14 @@ RELEASE_ARCHIVES = \ |
33 | 33 |
|
34 | 34 | TOOL_BIN_DIR = tools/bin |
35 | 35 | TOOL_TARGETS = \ |
36 | | - $(TOOL_BIN_DIR)/gosec \ |
37 | | - $(TOOL_BIN_DIR)/staticcheck \ |
38 | | - $(TOOL_BIN_DIR)/govulncheck |
| 36 | + $(TOOL_BIN_DIR)/govulncheck \ |
| 37 | + $(TOOL_BIN_DIR)/golangci-lint |
39 | 38 |
|
40 | 39 |
|
41 | 40 | help: ## Show this help. |
42 | 41 | @awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {sub("\\\\n",sprintf("\n%22c"," "), $$2);printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) |
43 | 42 |
|
44 | | -all: check-go-version vet sec static build ## Run the tests and build the binary. |
| 43 | +all: check-go-version golangci-lint build ## Run the tests and build the binary. |
45 | 44 |
|
46 | 45 | build: auth auth-amd64 auth-arm64 auth-darwin-arm64 ## Build the binaries. |
47 | 46 |
|
@@ -74,9 +73,7 @@ deps: ## Install dependencies. |
74 | 73 |
|
75 | 74 | lint: \ |
76 | 75 | check-go-version \ |
77 | | - vet \ |
78 | | - static \ |
79 | | - sec \ |
| 76 | + golangci-lint \ |
80 | 77 | vulncheck |
81 | 78 |
|
82 | 79 | release-test: lint test |
@@ -117,41 +114,24 @@ test: auth ## Run tests. |
117 | 114 | go test -failfast $(CHECK_FILES) -coverprofile=coverage.out -coverpkg ./... -p 1 -race -v -count=1 |
118 | 115 | ./hack/coverage.sh |
119 | 116 |
|
120 | | -vet: # Vet the code |
121 | | - go vet $(CHECK_FILES) |
122 | | - |
123 | 117 | check-go-version: ## Verify the pinned Go version matches across go.mod, Dockerfiles, and submodules. |
124 | 118 | ./hack/check-go-version.sh |
125 | 119 |
|
126 | 120 | .NOTPARALLEL: $(TOOL_TARGETS) |
127 | 121 | $(TOOL_TARGETS): |
128 | 122 | $(MAKE) -C tools |
129 | 123 |
|
130 | | -sec: | $(TOOL_BIN_DIR)/gosec # Check for security vulnerabilities |
131 | | - $(TOOL_BIN_DIR)/gosec \ |
132 | | - -quiet \ |
133 | | - -exclude-generated \ |
134 | | - -exclude=G117,G120,G704 \ |
135 | | - $(CHECK_FILES) |
136 | | - $(TOOL_BIN_DIR)/gosec \ |
137 | | - -quiet \ |
138 | | - -tests \ |
139 | | - -exclude-generated \ |
140 | | - -exclude=G101,G104,G117,G120,G704 \ |
141 | | - $(CHECK_FILES) |
| 124 | +sec: | $(TOOL_BIN_DIR)/golangci-lint # Check for security issues (gosec) |
| 125 | + $(TOOL_BIN_DIR)/golangci-lint run --enable-only=gosec $(CHECK_FILES) |
142 | 126 |
|
143 | 127 | vulncheck: $(TOOL_BIN_DIR)/govulncheck # Check for known vulnerabilities |
144 | 128 | $(TOOL_BIN_DIR)/govulncheck $(CHECK_FILES) | go run ./hack/vulncheck-filter |
145 | 129 |
|
146 | | -unused: | $(TOOL_BIN_DIR)/staticcheck # Look for unused code |
147 | | - @echo "Unused code:" |
148 | | - $(TOOL_BIN_DIR)/staticcheck -checks U1000 $(CHECK_FILES) |
149 | | - @echo |
150 | | - @echo "Code used only in _test.go (do move it in those files):" |
151 | | - $(TOOL_BIN_DIR)/staticcheck -checks U1000 -tests=false $(CHECK_FILES) |
| 130 | +unused: | $(TOOL_BIN_DIR)/golangci-lint # Look for unused code |
| 131 | + $(TOOL_BIN_DIR)/golangci-lint run --enable-only=unused $(CHECK_FILES) |
152 | 132 |
|
153 | | -static: | $(TOOL_BIN_DIR)/staticcheck |
154 | | - $(TOOL_BIN_DIR)/staticcheck ./... |
| 133 | +golangci-lint: | $(TOOL_BIN_DIR)/golangci-lint |
| 134 | + $(TOOL_BIN_DIR)/golangci-lint run $(CHECK_FILES) |
155 | 135 |
|
156 | 136 | generate: | check-oapi-codegen |
157 | 137 | go generate ./... |
|
0 commit comments