-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
63 lines (55 loc) · 1.49 KB
/
Makefile
File metadata and controls
63 lines (55 loc) · 1.49 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
.PHONY: all clean tests lint build format benchmarks
all: build tests lint
COMPONENTS = things/testurl helpers/counter fakes/fakectx
# Run tests for all modules
tests:
@echo "Running tests for all modules..."
@for dir in $(COMPONENTS); do \
$(MAKE) -C $$dir tests || exit 1; \
done
# Run benchmarks for all modules
benchmarks:
@echo "Running benchmarks for all modules..."
@for dir in $(COMPONENTS); do \
$(MAKE) -C $$dir benchmarks || exit 1; \
done
# Build all modules
build:
@echo "Building all modules..."
@for dir in $(COMPONENTS); do \
$(MAKE) -C $$dir build || exit 1; \
done
# Format all code
format:
@echo "Formatting code..."
@gofmt -s -w .
@if command -v golines >/dev/null 2>&1; then \
golines -w .; \
else \
echo "golines not installed, skipping line wrapping"; \
fi
@for dir in $(COMPONENTS); do \
$(MAKE) -C $$dir format || exit 1; \
done
# Lint all code
lint:
@echo "Linting code..."
@if command -v golangci-lint >/dev/null 2>&1; then \
golangci-lint run ./...; \
for dir in $(COMPONENTS); do \
$(MAKE) -C $$dir lint || exit 1; \
done; \
else \
echo "golangci-lint not installed, skipping lint"; \
fi
# Clean build artifacts
clean:
@echo "Cleaning build artifacts..."
@for dir in $(COMPONENTS); do \
$(MAKE) -C $$dir clean || exit 1; \
done
@find . -type f -name "*.test" -delete
@find . -type f -name "coverage.out" -delete
@find . -type f -name "coverage.html" -delete
@find . -type d -name "vendor" -exec rm -rf {} + 2>/dev/null || true
@rm -rf bin/