-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
72 lines (59 loc) · 3.15 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 Install ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
# --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
.PHONY: lefthook-install
lefthook-install:
(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:
go get -f -t -u ./...
go get -f -u ./...
.PHONY: go-generate
go-generate:
go generate ./...
.PHONY: go-fmt
go-fmt:
(command -v golangci-lint || go install github.com/golangci/golangci-lint/v2/cmd/[email protected]) && golangci-lint fmt ./...
.PHONY: go-lint
go-lint: go-fmt
(command -v golangci-lint || go install github.com/golangci/golangci-lint/v2/cmd/[email protected]) && golangci-lint run ./...
.PHONY: go-test
go-test:
go test -v -race ./...
# --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
# --- Help -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
# --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
.PHONY: help
help:
@echo ""
@echo "Available commands:"
@echo ""
@echo " Setup Commands:"
@echo ""
@echo " lefthook-install ......... Install Git hooks."
@echo ""
@echo " Go Commands:"
@echo ""
@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 Commands:"
@echo ""
@echo " help ..................... Display this help information."
@echo ""
.DEFAULT_GOAL = help