-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
37 lines (26 loc) · 818 Bytes
/
Makefile
File metadata and controls
37 lines (26 loc) · 818 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
.DEFAULT_GOAL := help
.PHONY: help build test vet lint fmt clean all
BINARY := gen-commit-msg
CMD := ./cmd/$(BINARY)
VERSION ?= dev
LDFLAGS := -ldflags "-X main.version=$(VERSION)"
help: ## Show this help
@echo "Usage: make [target]"
@echo ""
@echo "Targets:"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | \
awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}'
build: ## Build the binary
go build $(LDFLAGS) -o $(BINARY) $(CMD)
VERBOSE ?=
test: ## Run tests (VERBOSE=1 for verbose output)
go test -count=1 -race $(if $(VERBOSE),-v) ./...
vet: ## Run go vet
go vet ./...
lint: ## Run golangci-lint
golangci-lint run ./...
fmt: ## Run go fmt
go fmt ./...
clean: ## Remove the binary
rm -f $(BINARY)
all: fmt vet lint test build ## Run all checks and build