This repository has been archived by the owner on Jun 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
55 lines (44 loc) · 1.74 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
.PHONY: test
test: ## Run all the tests
rm -f coverage.tmp && rm -f coverage.txt
echo 'mode: atomic' > coverage.txt && go list ./... | xargs -n1 -I{} sh -c 'go test -race -covermode=atomic -coverprofile=coverage.tmp {} && tail -n +2 coverage.tmp >> coverage.txt' && rm coverage.tmp
cover: test ## Run all the tests and opens the coverage report
go tool cover -html=coverage.txt
fmt: ## gofmt and goimports all go files
find . -name '*.go' -not -wholename './vendor/*' | while read -r file; do gofmt -w -s "$$file"; goimports -w "$$file"; done
fmt-run: ## run gofmt all go files without changing
find . -name '*.go' -not -wholename './vendor/*' | while read -r file; do gofmt -l -s "$$file"; done
lint: fmt ## Run all the linters
gometalinter --vendor --disable-all \
--enable=deadcode \
--enable=gocyclo \
--enable=ineffassign \
--enable=gosimple \
--enable=staticcheck \
--enable=gofmt \
--enable=golint \
--enable=goimports \
--enable=dupl \
--enable=misspell \
--enable=errcheck \
--enable=vet \
--enable=vetshadow \
--enable=varcheck \
--enable=structcheck \
--enable=interfacer \
--enable=goconst \
--deadline=10m \
./...
test-file:
make build; mv .build/git-hook-commit ~/go/bin; git-hook-commit test/commit-message
snapshot: ## Create snapshot build
goreleaser --skip-publish --rm-dist --snapshot
release: ## Create release build
goreleaser --rm-dist
build: ## build binary to .build folder
-rm -f .build/git-hook-commit
go build -o ".build/git-hook-commit" cmd/main.go
# Self-Documented Makefile see https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
help:
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
.DEFAULT_GOAL := help