-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
49 lines (38 loc) · 1.18 KB
/
Makefile
File metadata and controls
49 lines (38 loc) · 1.18 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
.PHONY: build test lint clean install snapshot cover vet
BINARY := git-profile
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")
LDFLAGS := -ldflags "-s -w \
-X main.version=$(VERSION) \
-X main.commit=$(COMMIT) \
-X main.date=$(DATE)"
## build: Compile the binary to ./git-profile
build:
go build $(LDFLAGS) -o $(BINARY) .
## install: Install to $GOPATH/bin (or $GOBIN)
install:
go install $(LDFLAGS) .
## test: Run all unit tests with race detection
test:
go test -v -race -coverprofile=coverage.out ./...
## cover: Open coverage report in browser
cover: test
go tool cover -html=coverage.out
## vet: Run go vet
vet:
go vet ./...
## lint: Run golangci-lint (requires golangci-lint to be installed)
lint:
golangci-lint run ./...
## snapshot: Build a GoReleaser snapshot (no publish)
snapshot:
goreleaser release --snapshot --clean
## clean: Remove build artifacts
clean:
rm -f $(BINARY) coverage.out
## help: Show this help
help:
@echo "Usage: make <target>"
@echo ""
@grep -E '^## ' $(MAKEFILE_LIST) | sed 's/## / /'