forked from abagayev/go-forwardemail
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
80 lines (66 loc) · 1.92 KB
/
Makefile
File metadata and controls
80 lines (66 loc) · 1.92 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
74
75
76
77
78
79
.PHONY: all build test lint fmt clean generate deps help
# Default target
all: deps lint test
# Install dependencies
deps:
@echo "Installing dependencies..."
@go mod download
@go mod tidy
# Run tests
test:
@echo "Running tests..."
@go test -v -race -coverprofile=coverage.out ./...
# Run tests with coverage report
test-coverage: test
@echo "Generating coverage report..."
@go tool cover -html=coverage.out -o coverage.html
@echo "Coverage report generated: coverage.html"
# Run linter
lint:
@echo "Running linter..."
@golangci-lint run ./...
# Format code
fmt:
@echo "Formatting code..."
@gofumpt -l -w .
# Run code generation
generate:
@echo "Running code generation..."
@cd tools; go generate ./...
# Clean build artifacts
clean:
@echo "Cleaning..."
@rm -f coverage.out coverage.html
@go clean -cache -testcache
# Install pre-commit hooks
hooks:
@echo "Installing pre-commit hooks..."
@pre-commit install
# Run pre-commit on all files
pre-commit:
@echo "Running pre-commit..."
@pre-commit run --all-files
# Verify module
verify:
@echo "Verifying module..."
@go mod verify
# Check for vulnerabilities
vuln:
@echo "Checking for vulnerabilities..."
@go run golang.org/x/vuln/cmd/govulncheck@latest ./...
# Help
help:
@echo "Available targets:"
@echo " all - Run deps, lint, and test (default)"
@echo " deps - Install dependencies"
@echo " test - Run tests with race detection"
@echo " test-coverage - Run tests and generate HTML coverage report"
@echo " lint - Run golangci-lint"
@echo " fmt - Format code with gofumpt"
@echo " generate - Run code generation"
@echo " clean - Remove build artifacts"
@echo " hooks - Install pre-commit hooks"
@echo " pre-commit - Run pre-commit on all files"
@echo " verify - Verify module dependencies"
@echo " vuln - Check for vulnerabilities"
@echo " help - Show this help message"