-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
executable file
·69 lines (56 loc) · 1.61 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
# ==================================================================================== #
# HELPERS
# ==================================================================================== #
## help: print this help message
.PHONY: help
help:
@echo 'Usage:'
@sed -n 's/^##//p' ${MAKEFILE_LIST} | column -t -s ':' | sed -e 's/^/ /'
VERSION=$(shell git rev-parse --short HEAD)
# ==================================================================================== #
# QUALITY CONTROL
# ==================================================================================== #
.PHONE: init
init:
go mod tidy -v
go mod verify
go mod download
## lint : run linters
.PHONY: lint
lint:
go run github.com/golangci/golangci-lint/cmd/golangci-lint@latest run ./...
## tidy: format code and tidy modfile
.PHONY: tidy
tidy:
go fmt ./...
go mod tidy -v
## audit: run quality control checks
.PHONY: audit
audit:
go vet ./...
go run honnef.co/go/tools/cmd/staticcheck@latest -checks=all,-ST1000,-U1000 ./...
go test -race -vet=off ./...
go mod verify
# ==================================================================================== #
# BUILD
# ==================================================================================== #
## build: build the cmd/cleaner application
.PHONY: build
build:
go mod verify
go build -o=./bin/cleaner .
## run: run the cmd/cleaner application
.PHONY: run
run:
go run main.go
.PHONE: test
test:
go test -v ./...
## clean: clean up the build artifacts
.PHONY: clean
clean:
rm -rf ./bin
## docker: build the docker image
.PHONY: docker
docker:
docker buildx build --load -t cleaner:$(VERSION) .