-
Notifications
You must be signed in to change notification settings - Fork 40
Expand file tree
/
Copy pathMakefile
More file actions
67 lines (50 loc) · 1.4 KB
/
Copy pathMakefile
File metadata and controls
67 lines (50 loc) · 1.4 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
MAKE_DIR:=$(strip $(shell dirname "$(realpath $(lastword $(MAKEFILE_LIST)))"))
.PHONY: help bin clean lint test test-unit test-integration fix gomodules lint-gomodules gofmt lint-gofmt goimports lint-goimports lint-govet
default: help
# list all make targets
help:
@grep -E '^[^_.#[:space:]].*:' "$(MAKE_DIR)/Makefile" | grep -v ':=' | cut -d':' -f1 | sort
# compile all command binaries
bin:
scripts/build.sh
# remove compiled binaries
clean:
scripts/clean.sh
# run unit tests
test-unit:
go test -v ./...
# run integration tests
test-integration:
go test -v -tags=integration ./pkg/watch/...
# run all tests
test: test-unit test-integration
# run all linters
lint: lint-gomodules lint-gofmt lint-goimports lint-govet
# fix (some) lint violations
fix: gofmt goimports
# update and remove unused go modules (all workspace modules)
gomodules:
for dir in $$(scripts/go-modules.sh); do \
(cd "$$dir" && go mod tidy); \
done
go work vendor
# check if any go modules need updating (all workspace modules)
lint-gomodules:
for dir in $$(scripts/go-modules.sh); do \
(cd "$$dir" && go mod verify); \
done
# format go code
gofmt:
scripts/go-find.sh | xargs gofmt -s -w
# lint go code formatting
lint-gofmt:
scripts/lint-gofmt.sh
# update go imports
goimports:
scripts/go-find.sh | xargs goimports -w
# lint go imports
lint-goimports:
scripts/lint-goimports.sh
# vet go code
lint-govet:
scripts/lint-govet.sh