-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
73 lines (59 loc) · 1.81 KB
/
Makefile
File metadata and controls
73 lines (59 loc) · 1.81 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
62
63
64
65
66
67
68
69
70
71
72
73
# Helper Makefile for Go projects
# Aligned with the golang-development Claude Code skill best practices
.PHONY: help format lint vet staticcheck test test-race bench fuzz coverage clean
# Default target
help:
@echo "Go Development Helpers (aligned with golang-development skill)"
@echo ""
@echo "format - Run gofmt/goimports on all .go files"
@echo "lint - Run revive (modern golint replacement)"
@echo "vet - Run go vet"
@echo "staticcheck - Run staticcheck (honorable linter)"
@echo "test - Run tests"
@echo "test-race - Run tests with race detector"
@echo "bench - Run benchmarks (with memory stats)"
@echo "bench-cmp - Compare benchmarks (requires old.txt/new.txt)"
@echo "fuzz - Run all fuzz tests for 30s each"
@echo "coverage - Generate test coverage report"
@echo "clean - Remove build artifacts and coverage files"
@echo ""
# Formatting
format:
go fmt ./...
goimports -w .
# Linting & static analysis
lint:
revive -config .revive.toml -formatter friendly ./... || true
vet:
go vet ./...
staticcheck:
staticcheck ./...
# Testing
test:
go test -short ./...
test-race:
go test -race -count=1 -timeout=30s ./...
# Benchmarking
bench:
go test -bench=. -benchmem -run=^$$ ./...
bench-cmp:
@if [ ! -f old.txt ] || [ ! -f new.txt ]; then \
echo "Error: Need old.txt and new.txt for comparison"; \
exit 1; \
fi
benchstat old.txt new.txt
# Fuzzing
fuzz:
go test -fuzz=. -fuzztime=30s ./...
# Coverage
coverage:
go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out -o coverage.html
@echo "Coverage report: coverage.html"
# Clean
clean:
rm -f coverage.out coverage.html *.prof *.txt
go clean
# All-in-one quality gate (recommended for CI or pre-commit)
check: format vet staticcheck lint test-race
@echo "All checks passed!"