-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
47 lines (38 loc) · 1.33 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
.PHONT: tools
tools: ## Run tools (vet, gofmt, goimports, tidy, etc.)
@go version
gofmt -w .
goimports -w .
go mod tidy
go vet ./...
.PHONT: tools.update
tools.update: ## Update or install tool
go install golang.org/x/tools/cmd/goimports@latest
go install github.com/golangci/golangci-lint/cmd/[email protected]
.PHONT: deps.update
deps.update: ## Update dependencies versions
go get -u all
go mod tidy
.PHONY: lint
lint: ## Run `golangci-lint`
@go version
@golangci-lint --version
@golangci-lint run ./...
.PHONT: test
test: ## Run all tests in project with coverage
@go test ./... -cover
.PHONT: test.cover.all
test.cover.all: ## Run tests with coverage (show all coverage)
go test -v ./... -cover -coverprofile cover.out && go tool cover -func cover.out
.PHONT: build
build: ## Build binaries from source
@go build -o progen .
.PHONT: install
install: ## Install binaries from source
@go install .
.PHONY: list
list: ## List all make targets
@${MAKE} -pRrn : -f $(MAKEFILE_LIST) 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | egrep -v -e '^[^[:alnum:]]' -e '^$@$$' | sort
.PHONY: help
help: ## List all make targets with description
@grep -h -E '^[.a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'