-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
67 lines (49 loc) · 1.08 KB
/
Makefile
File metadata and controls
67 lines (49 loc) · 1.08 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
55
56
57
58
59
60
61
62
63
64
65
66
67
SHELL:=/bin/bash
GO = go
GO_VET_OPTS = -v
GO_TEST_OPTS=-v -race
GO_FMT=gofumpt
GO_FMT_OPTS=-l -w
GO_IMPORTS=goimports
GO_IMPORTS_OPTS=-w -local github.com/chez-shanpu/kubectl-mft
STATIC_CHECK=staticcheck
.PHONY: fmt
fmt:
$(GO_FMT) $(GO_FMT_OPTS) .
$(GO_IMPORTS) $(GO_IMPORTS_OPTS) .
.PHONY: mod
mod:
$(GO) mod tidy
.PHONY: fix
fix:
$(GO) fix ./...
.PHONY: check-diff
check-diff: mod fmt fix
git diff --exit-code --name-only
.PHONY: vet
vet:
$(GO) vet $(GO_VET_OPTS) ./...
.PHONY: test
test:
$(STATIC_CHECK) ./...
$(GO) test $(GO_TEST_OPTS) ./...
.PHONY: test-e2e
test-e2e:
@$(MAKE) -C test test
.PHONY: build
build:
$(GO) build -ldflags "-X github.com/chez-shanpu/kubectl-mft/cmd.version=dev -X github.com/chez-shanpu/kubectl-mft/cmd.commit=$$(git rev-parse --short HEAD 2>/dev/null || echo 'none')" -o bin/ .
.PHONY: clean
clean:
-$(GO) clean
-rm $(RM_OPTS) $(BIN_DIR)
.PHONY: check-goreleaser
check-goreleaser:
goreleaser check
.PHONY: check
check: vet check-diff test check-goreleaser
.PHONY: check-all
check-all: check test-e2e
.PHONY: all
all: check build
.DEFAULT_GOAL=all