-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
43 lines (32 loc) · 1.27 KB
/
Copy pathMakefile
File metadata and controls
43 lines (32 loc) · 1.27 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
BINARY := gitpal
PKG := ./...
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null || echo none)
DATE := $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
MODULE := github.com/realmaxc/gitpal
LDFLAGS := -s -w \
-X $(MODULE)/internal/version.Version=$(VERSION) \
-X $(MODULE)/internal/version.Commit=$(COMMIT) \
-X $(MODULE)/internal/version.Date=$(DATE)
.PHONY: build test cover fmt vet lint tidy install clean help
build: ## Build the gitpal binary
go build -ldflags "$(LDFLAGS)" -o $(BINARY) ./cmd/gitpal
test: ## Run the test suite with the race detector
go test -race $(PKG)
cover: ## Run tests and print a coverage summary
go test -coverprofile=coverage.out $(PKG)
go tool cover -func=coverage.out | tail -n 1
fmt: ## Format all Go sources
gofmt -w .
vet: ## Run go vet
go vet $(PKG)
lint: ## Run golangci-lint
golangci-lint run
tidy: ## Tidy and verify go.mod/go.sum
go mod tidy
install: ## Install gitpal into GOBIN
go install -ldflags "$(LDFLAGS)" ./cmd/gitpal
clean: ## Remove build and coverage artifacts
rm -f $(BINARY) coverage.out coverage.html
help: ## List available targets
@grep -hE '^[a-z].*:.*##' $(MAKEFILE_LIST) | sort | awk -F ":.*## " '{printf " %-10s %s\n", $$1, $$2}'