-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
46 lines (34 loc) · 980 Bytes
/
Makefile
File metadata and controls
46 lines (34 loc) · 980 Bytes
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
GOFILES = $(shell find . -name '*.go' -not -path './vendor/*')
GOPACKAGES = $(shell go list ./... | grep -v /vendor/)
default: test
workdir:
mkdir -p workdir
# For library projects, build means compile-check all packages
build: $(GOFILES)
go build ./...
# Native build also just checks compilation for libraries
build-native: $(GOFILES)
go build ./...
# Run tests
test: test-all
test-all:
@go test -v $(GOPACKAGES)
# Run tests with coverage
test-coverage:
@go test -race -coverprofile=coverage.out -covermode=atomic $(GOPACKAGES)
# Format code
fmt:
@go fmt $(GOPACKAGES)
# Lint code
lint:
@if command -v golangci-lint >/dev/null 2>&1; then \
golangci-lint run; \
else \
echo "golangci-lint not installed, skipping linting"; \
fi
# Run all quality checks
check: fmt lint test-coverage
# Clean build artifacts
clean:
rm -rf workdir coverage.out coverage.html coverage.txt
.PHONY: default build build-native test test-all test-coverage fmt lint check clean