-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
50 lines (36 loc) · 1.07 KB
/
Copy pathMakefile
File metadata and controls
50 lines (36 loc) · 1.07 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
BINARY := vane
CTL := vanectl
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 := -s -w -X main.version=$(VERSION) -X main.commit=$(COMMIT) -X main.date=$(DATE)
GOFILES := $(shell find . -name '*.go' -not -path './vendor/*')
.PHONY: all build test race cover lint fmt vet tidy run demo docker clean
all: lint test build
build:
@mkdir -p bin
go build -trimpath -ldflags "$(LDFLAGS)" -o bin/$(BINARY) ./cmd/vane
go build -trimpath -ldflags "$(LDFLAGS)" -o bin/$(CTL) ./cmd/vanectl
test:
go test ./...
race:
go test -race ./...
cover:
go test -coverprofile=coverage.out ./...
go tool cover -func=coverage.out | tail -1
lint:
golangci-lint run ./...
fmt:
gofmt -w $(GOFILES)
vet:
go vet ./...
tidy:
go mod tidy
run: build
./bin/$(BINARY) -config configs/vane.yaml
demo:
./scripts/demo.sh
docker:
docker build -t vane:$(VERSION) .
clean:
rm -rf bin dist coverage.out coverage.html