-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathMakefile
More file actions
69 lines (58 loc) · 1.57 KB
/
Makefile
File metadata and controls
69 lines (58 loc) · 1.57 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
.PHONY: build test clean lint fmt vet coverage install-hooks help
# Default target
all: build
# Build the application
build:
@echo "Building..."
@go build -v ./...
# Run all tests
test:
@echo "Running tests..."
@go test -v ./...
# Run tests with coverage
coverage:
@echo "Running tests with coverage..."
@go test -cover -coverprofile=coverage.out ./...
@go tool cover -html=coverage.out -o coverage.html
@echo "Coverage report generated at coverage.html"
# Clean build artifacts
clean:
@echo "Cleaning..."
@rm -f coverage.out coverage.html
@go clean
# Run go fmt
fmt:
@echo "Formatting code..."
@go fmt ./...
# Run go vet
vet:
@echo "Vetting code..."
@go vet ./...
# Run golint if installed
lint:
@echo "Linting code..."
@if command -v golint > /dev/null; then \
golint ./...; \
else \
echo "golint not installed. Run: go install golang.org/x/lint/golint@latest"; \
fi
# Run all quality checks
quality: fmt vet lint
# Install Git hooks
install-hooks:
@echo "Installing Git hooks..."
@./scripts/install-hooks.sh
# Show help
help:
@echo "Available targets:"
@echo " all - Build the application (default)"
@echo " build - Build the application"
@echo " test - Run tests"
@echo " coverage - Run tests with coverage report"
@echo " clean - Clean build artifacts"
@echo " fmt - Run go fmt"
@echo " vet - Run go vet"
@echo " lint - Run golint (if installed)"
@echo " quality - Run all quality checks (fmt, vet, lint)"
@echo " install-hooks - Install Git pre-commit hooks"
@echo " help - Show this help message"