-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
50 lines (38 loc) · 1.2 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
# Inspired by https://github.com/gofiber/fiber/blob/7b3a36f22fc1166ceb9cb78cf69b3a2f95d077da/Makefile
.PHONY: help all align audit build clean format lint run tidy up
version=$(shell cat VERSION 2>/dev/null)
help:
@sed -n 's/^##//p' ${MAKEFILE_LIST} | column -t -s ':' | sed -e 's/^/ /'
## all: 🚀 Run pre-commit tasks
all: audit align tidy format lint build
## align: 📏 Optimize struct fields
align:
go run github.com/dkorunic/betteralign/cmd/[email protected] -apply ./...
## audit: 🚀 Conduct quality checks
audit:
go mod verify
go vet ./...
go run golang.org/x/vuln/cmd/[email protected] -show verbose ./...
build: clean
CGO_ENABLED=0 \
go build -trimpath -buildmode=pie \
-ldflags="-s -w -X main.version=${version}" \
-o bin/pinnacle-${version}.bin .
## clean: 🧹 Remove artifacts
clean:
rm -rf ./bin
## format: 🎨 Fix code formatting
format:
go run mvdan.cc/[email protected] -w -l .
## lint: 🚨 Run lint checks
lint:
go run github.com/golangci/golangci-lint/cmd/[email protected] run ./...
## run: ⚙️ Build and run app
run: build
./bin/pinnacle-${version}.bin
## tidy: 📌 Clean dependencies
tidy:
go mod tidy -v
## up: 🔺 Update dependencies
up:
go get -u ./...