This repository has been archived by the owner on Oct 4, 2024. It is now read-only.
generated from golang-templates/seed
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
63 lines (51 loc) · 1.31 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
56
57
58
59
60
61
62
63
SHELL := /bin/bash
.DEFAULT_GOAL := all
.PHONY: all
all: ## build pipeline
all: mod build spell lint test
.PHONY: ci
ci: ## CI build pipeline
ci: all
.PHONY: help
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: clean
clean: ## remove files created during build pipeline
$(call print-target)
rm -rf dist
rm -f coverage.*
rm -f '"$(shell go env GOCACHE)/../golangci-lint"'
go clean -i -cache -testcache -modcache -fuzzcache -x
.PHONY: mod
mod: ## go mod tidy
$(call print-target)
go mod tidy
.PHONY: build
build: ## goreleaser build
build:
$(call print-target)
goreleaser build --rm-dist --single-target --snapshot
.PHONY: spell
spell: ## misspell
$(call print-target)
misspell -error -locale=US -w **.md
.PHONY: lint
lint: ## golangci-lint
$(call print-target)
golangci-lint run --fix
.PHONY: test
test: ## go test
$(call print-target)
go test -race -covermode=atomic -coverprofile=coverage.out -coverpkg=./... ./...
go tool cover -html=coverage.out -o coverage.html
.PHONY: test-fast
test-fast: ## go test
$(call print-target)
go test -v ./...
.PHONY: benchmark
benchmark: ## go test
$(call print-target)
go test ./... -bench=.
define print-target
@printf "Executing target: \033[36m$@\033[0m\n"
endef