-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
62 lines (48 loc) · 1.28 KB
/
Makefile
File metadata and controls
62 lines (48 loc) · 1.28 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
GOLANGCI_LINT_VERSION := v2.10.1
.PHONY: all setup deps test test-v vet lint bench build fmt cover clean ci
all: fmt vet lint test build
## Install development tools (skips if already present)
setup:
@command -v golangci-lint >/dev/null 2>&1 || { \
echo "Installing golangci-lint $(GOLANGCI_LINT_VERSION)..."; \
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION); \
}
@command -v goimports >/dev/null 2>&1 || { \
echo "Installing goimports..."; \
go install golang.org/x/tools/cmd/goimports@latest; \
}
## Download module dependencies
deps:
go mod download
## Run all tests with race detector
test:
go test -race -count=1 ./...
## Run tests with verbose output
test-v:
go test -race -v -count=1 ./...
## Run go vet
vet:
go vet ./...
## Run golangci-lint
lint: setup
golangci-lint run ./...
## Run benchmarks
bench:
go test -bench=. -benchmem ./...
## Build all packages
build:
go build ./...
## Format code
fmt:
gofmt -w .
goimports -w .
## Run tests with coverage report
cover:
go test -race ./... -coverprofile=coverage.out
go tool cover -html=coverage.out -o coverage.html
@echo "Coverage report: coverage.html"
## Remove build artifacts
clean:
rm -f coverage.out coverage.html
## CI pipeline: vet, lint, test
ci: vet lint test