This repository has been archived by the owner on Jan 14, 2022. It is now read-only.
/
Makefile
56 lines (40 loc) · 1.57 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
SOURCE_FILES?=$$(go list ./... | grep -v /vendor/)
TEST_PATTERN?=.
TEST_OPTIONS?=
install: build ## build and install
go install .
setup: ## Install all the build and lint dependencies
./scripts/setup.sh
test: ## Run all the tests
gotestcover $(TEST_OPTIONS) -covermode=atomic -coverprofile=coverage.txt $(SOURCE_FILES) -run $(TEST_PATTERN) -timeout=30s
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
lint: ## Run all the linters
./scripts/lint.sh
precommit: ## Run precommit hook
./scripts/lint.sh
ci: build lint test ## travis-ci entrypoint
./samples/godownloader-goreleaser.sh
git diff .
./bin/goreleaser --snapshot
build: hooks ## Build a beta version of goreleaser
go build
./scripts/build_samples.sh
.DEFAULT_GOAL := build
generate: ## regenerate shell code from client9/shlib
./makeshellfn.sh > shellfn.go
.PHONY: ci help generate samples clean
clean: ## clean up everything
go clean ./...
rm -f godownloader
rm -rf ./bin ./dist
git gc --aggressive
# https://www.client9.com/automatically-install-git-hooks/
.git/hooks/pre-commit: scripts/lint.sh
cp -f scripts/lint.sh .git/hooks/pre-commit
hooks: .git/hooks/pre-commit
# Absolutely awesome: http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'