-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
76 lines (58 loc) · 1.32 KB
/
Makefile
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
# Makefile for NVCF CLI
BINARY_NAME := nvcf
## Default target: build the project
all: check install
## Install the binary
install:
go install
## Build the binary
build:
go build -o $(BINARY_NAME)
## Clean up build artifacts
clean:
go clean
rm -f $(BINARY_NAME)
## Run tests
test:
go test ./...
## Run all checks: fmt, vet, lint, and test
check: fmt vet lint test
## Format the code
fmt:
gofmt -s -w .
## Run go vet
vet:
go vet ./...
## Run linter
lint: deps-lint
golangci-lint run
## Quick rebuild: clean and build
q: clean build
## Install linter dependency
deps-lint:
@command -v golangci-lint > /dev/null || (go install github.com/golangci/golangci-lint/cmd/[email protected])
## Show this help message
help:
@echo "Usage: make [target]"
@echo ""
@echo "Targets:"
@awk '/^[a-zA-Z\-\_0-9]+:/ { \
helpMessage = match(lastLine, /^## (.*)/); \
if (helpMessage) { \
helpCommand = substr($$1, 0, index($$1, ":")-1); \
helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \
printf " %-20s %s\n", helpCommand, helpMessage; \
} \
} \
{ lastLine = $$0 }' $(MAKEFILE_LIST)
## Build docs
docs:
go run . docs
## Clean up docs dir
cleandocs:
rm -rf ./docs
dry-release:
goreleaser release --snapshot --clean
release:
goreleaser release --clean
.PHONY: all build clean test check fmt vet lint q deps-lint help