-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
57 lines (45 loc) · 1.33 KB
/
Makefile
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
55
56
57
SHELL = /bin/bash -o pipefail
GIT_COMMIT := $(shell git rev-parse --short HEAD)
LDFLAGS := -X main.GitCommit=${GIT_COMMIT}
GIT_UNTRACKED = $(shell git diff-index --quiet HEAD -- || echo "(updated)")
LDFLAGS += -X main.GitUntracked=${GIT_UNTRACKED}
GIT_TAG = $(shell git describe)
LDFLAGS += -X main.GitLatestTag=${GIT_TAG}
REBUILD_DOCS ?= true
MOCKGEN_VER ?= v1.6.0
.PHONY: build
build: docs
go build -mod=vendor -o meroxa cmd/meroxa/main.go
.PHONY: install
install:
go build -ldflags "$(LDFLAGS)" -o $$(go env GOPATH)/bin/meroxa cmd/meroxa/main.go
.PHONY: gomod
gomod:
go mod tidy && go mod vendor
.PHONY: fmt
fmt: gofumpt
gofumpt -l -w .
.PHONY: test
test:
go test -v ${GO_TEST_FLAGS} -count=1 -timeout 5m ./...
.PHONY: docs
ifeq ($(REBUILD_DOCS), true)
docs:
rm -rf docs/cmd && mkdir -p docs/cmd/{md,www}
rm -rf etc && mkdir -p etc/man/man1 && mkdir -p etc/completion
go run gen-docs/main.go
endif
.PHONY: fig
fig:
go run gen-spec/main.go
.PHONY: lint
lint:
docker pull golangci/golangci-lint:latest
docker run --rm -v $(CURDIR):/app -w /app golangci/golangci-lint:latest golangci-lint run --timeout 5m -v
.PHONY: generate
generate: mockgen-install
go generate ./...
mockgen-install:
go install github.com/golang/mock/mockgen@$(MOCKGEN_VER)
gofumpt:
go install mvdan.cc/gofumpt@latest