-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
72 lines (59 loc) · 2.88 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
64
65
66
67
68
69
70
71
72
SHELL = /bin/sh
# --------------------------------------------------------------------------------------------------------------------------------------------------------------------------
# --- Git Hooks ------------------------------------------------------------------------------------------------------------------------------------------------------------
# --------------------------------------------------------------------------------------------------------------------------------------------------------------------------
.PHONY: git-hooks-install
git-hooks-install:
@# Install the latest version of Lefthook (a Git hooks manager) and set it up.
command -v lefthook || go install github.com/evilmartians/lefthook@latest; lefthook install
# --------------------------------------------------------------------------------------------------------------------------------------------------------------------------
# --- Go (Golang) ----------------------------------------------------------------------------------------------------------------------------------------------------------
# --------------------------------------------------------------------------------------------------------------------------------------------------------------------------
.PHONY: go-mod-clean
go-mod-clean:
go clean -modcache
.PHONY: go-mod-tidy
go-mod-tidy:
go mod tidy
.PHONY: go-mod-update
go-mod-update:
@# Update test dependencies.
go get -f -t -u ./...
@# Update all other dependencies.
go get -f -u ./...
.PHONY: go-generate
go-generate:
go generate ./...
.PHONY: go-fmt
go-fmt:
go fmt ./...
.PHONY: go-lint
go-lint: go-fmt
golangci-lint run $(GOLANGCILINT) ./...
.PHONY: go-test
go-test:
go test -v -race ./...
# --------------------------------------------------------------------------------------------------------------------------------------------------------------------------
# --- Help -----------------------------------------------------------------------------------------------------------------------------------------------------------------
# --------------------------------------------------------------------------------------------------------------------------------------------------------------------------
.PHONY: help
help:
@echo ""
@echo "Available commands:"
@echo ""
@echo " Git Hooks:"
@echo " git-hooks-install ........ Install Git hooks."
@echo ""
@echo " Go (Golang):"
@echo " go-mod-clean ............. Clean Go module cache."
@echo " go-mod-tidy .............. Tidy Go modules."
@echo " go-mod-update ............ Update Go modules."
@echo " go-generate .............. Run Go generate."
@echo " go-fmt ................... Format Go code."
@echo " go-lint .................. Lint Go code."
@echo " go-test .................. Run Go tests."
@echo ""
@echo " Help:"
@echo " help ..................... Display this help information."
@echo ""
.DEFAULT_GOAL = help