Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
61 lines (47 loc) · 1.71 KB
/
Copy pathMakefile
File metadata and controls
61 lines (47 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
BINARY := crawlctl
.DEFAULT_GOAL := help
.PHONY: help build test test-race test-release vet tidy tidy-check fmt lint check clean
help:
@printf '%s\n' \
'Available targets:' \
' help Print available targets (default).' \
' build Build the CLI into bin/$(BINARY).' \
' test Run the full Go test suite.' \
' fmt Check Go formatting.' \
' lint Run vet, dead-code, and vulnerability checks.' \
' check Run every local gate enforced by CI.' \
' test-race Run the Go test suite with the race detector.' \
' test-release Test the release dispatch guard (Node.js required).' \
' vet Run go vet (compatibility target).' \
' tidy Apply go.mod and go.sum tidying.' \
' tidy-check Verify go.mod and go.sum are tidy.' \
' clean Remove local build output.'
build:
mkdir -p bin
GOWORK=off go build -o bin/$(BINARY) ./cmd/crawlctl
test:
GOWORK=off go test ./...
test-race:
GOWORK=off go test -race ./...
test-release:
node --test .github/scripts/*.test.cjs
vet:
GOWORK=off go vet ./...
tidy:
GOWORK=off go mod tidy
tidy-check: tidy
git diff --exit-code -- go.mod go.sum
fmt:
@set -e; \
unformatted="$$(gofmt -l .)"; \
if [ -n "$$unformatted" ]; then echo "$$unformatted"; exit 1; fi
lint: vet
@set -e; \
output_file="$$(mktemp)"; \
trap 'rm -f "$$output_file"' 0; \
GOWORK=off go run golang.org/x/tools/cmd/deadcode@v0.52.0 -test ./... > "$$output_file"; \
if [ -s "$$output_file" ]; then cat "$$output_file"; exit 1; fi
GOWORK=off go run golang.org/x/vuln/cmd/govulncheck@v1.9.0 ./...
check: tidy-check fmt lint test test-race test-release
clean:
rm -rf bin