-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
54 lines (42 loc) · 1.1 KB
/
Copy pathMakefile
File metadata and controls
54 lines (42 loc) · 1.1 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
BINARY := hermes
MODULE := github.com/nullun/hermes-vault-cli
VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
LDFLAGS := -ldflags "-s -w -X main.version=$(VERSION)"
.PHONY: all build install clean test vet fmt lint run help
all: build
## build: compile the binary to ./hermes
build:
go build -trimpath $(LDFLAGS) -o $(BINARY) ./cmd/hermes
## install: install the binary to $(GOPATH)/bin
install:
go install -trimpath $(LDFLAGS) ./cmd/hermes
## run: build and run with --help
run: build
./$(BINARY) --help
## test: run all tests
test:
go test ./...
## vet: run go vet
vet:
go vet ./...
## fmt: format all Go source files
fmt:
gofmt -w .
## lint: run golangci-lint
lint:
@if command -v golangci-lint >/dev/null 2>&1; then \
golangci-lint run ./...; \
else \
echo "golangci-lint not found. Install it from https://golangci-lint.run/"; \
exit 1; \
fi
## tidy: tidy and verify go modules
tidy:
go mod tidy
go mod verify
## clean: remove build artefacts
clean:
rm -f $(BINARY)
## help: list available targets
help:
@grep -E '^## ' Makefile | sed 's/## / /'