-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
42 lines (29 loc) · 843 Bytes
/
Copy pathMakefile
File metadata and controls
42 lines (29 loc) · 843 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
38
39
40
41
42
BINARY := restorelab
PKG := github.com/techdev-lab/restorelab
CMD := ./cmd/restorelab
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
LDFLAGS := -X main.version=$(VERSION)
.PHONY: all build test vet fmt fmt-check lint clean install run validate
all: fmt-check vet test build
build:
go build -ldflags "$(LDFLAGS)" -o $(BINARY) $(CMD)
test:
go test ./...
vet:
go vet ./...
fmt:
gofmt -w cmd internal
fmt-check:
@out=$$(gofmt -l cmd internal); \
if [ -n "$$out" ]; then echo "not formatted:"; echo "$$out"; exit 1; fi
@echo "gofmt: OK"
lint: vet fmt-check
clean:
rm -f $(BINARY)
rm -f report.json report.html
install:
go install -ldflags "$(LDFLAGS)" $(CMD)
run: build
./$(BINARY) run examples/postgres-restic.yaml
validate: build
./$(BINARY) validate examples/postgres-restic.yaml