-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
56 lines (42 loc) · 1.14 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
BIN = multik8s
GO = go
VERSION = $(shell git describe --tags --abbrev=0)
LDFLAGS = -ldflags="-X github.com/eliasbokreta/multik8s/cmd.version=$(VERSION)"
SRC = $(shell find . -name "*.go")
.PHONY: tidy fmt fmt-check lint test build doc doc-check clean
default: all
all: tidy fmt lint test build doc
tidy:
$(info ▶ cleaning dependencies...)
$(GO) mod tidy
fmt:
$(info ▶ formatting...)
gofmt -s -w .
fmt-check:
$(info ▶ checking go format...)
ifneq ($(shell gofmt -d $(SRC) 2>/dev/null),)
$(error Error, please format your code using 'make fmt')
endif
lint:
$(info ▶ running lint tools...)
golangci-lint run -v
test:
$(info ▶ running tests...)
$(GO) test -v -coverprofile cover.out ./...
build:
$(info ▶ compiling program...)
$(GO) build $(LDFLAGS)
doc: build
$(info ▶ generating Cobra documentation...)
@mkdir -p docs
@rm -f docs/*
./$(BIN) doc
@mv ./docs/multik8s.md ./docs/README.md
doc-check: doc
$(info ▶ checking if documentation is up to date...)
ifneq ($(shell git status --porcelain docs/ 2>/dev/null),)
$(error Error, please re generate the documentation)
endif
clean:
$(info ▶ removing binary...)
rm $(BIN)