-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
57 lines (40 loc) · 1.68 KB
/
Makefile
File metadata and controls
57 lines (40 loc) · 1.68 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
###### Help ###################################################################
.DEFAULT_GOAL = help
.PHONY: help
help: ## list Makefile targets
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
###### Test ###################################################################
.PHONY: test
test: download lint test-units ## run lint and unit tests
.PHONY: test-units
test-units:
go tool ginkgo -r -p
.PHONY: download
download: ## download go module dependencies
go mod download
###### Lint ###################################################################
.PHONY: lint
lint: checkformat checkimports vet staticcheck ## lint the source
checkformat: ## check that the code is formatted correctly
@@if [ -n "$$(gofmt -s -e -l -d .)" ]; then \
echo "gofmt check failed: run 'gofmt -d -e -l -w .'"; \
exit 1; \
fi
checkimports: ## check that imports are formatted correctly
@@if [ -n "$$(go tool goimports -l -d .)" ]; then \
echo "goimports check failed: run 'make format'"; \
exit 1; \
fi
vet: ## run go vet
go vet ./...
staticcheck: ## run staticcheck
go tool staticcheck ./...
###### Format #################################################################
.PHONY: format
format: ## format the source
gofmt -s -e -l -w .
go tool goimports -l -w .
###### Build ##################################################################
.PHONY: build
build: ## use goreleaser to build the plugin for all target platforms
goreleaser build --rm-dist --snapshot