-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
53 lines (43 loc) · 1.21 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
# ################## Helpers ######################
## help: print this help message
.PHONY: help
help:
@echo 'Usage:'
@sed -n 's/^##//p' ${MAKEFILE_LIST} | column -t -s ':' | sed -e 's/^/ /'
.PHONY: confirm
confirm:
@echo -n "Are you sure? [y/N] " && read ans && [ $${ans:-N} = y ]
# ################## Dev ######################
.PHONY: redis
redis:
@go run .
# ################## QA ######################
.PHONY: audit
audit:
@echo 'Formatting code...'
go fmt ./...
@echo 'Vetting code...'
go vet ./...
# staticcheck ./...
@echo 'Running tests'
go test -race -vet=off ./...
@echo 'Tidying and verifying module dependencies...'
go mod tidy
go mod verify
.PHONY: test
test:
@echo 'Running tests'
go test -race -vet=off ./...
# ################## Build ######################
current_time = $(shell date --iso-8601=seconds)
git_desc = $(shell git describe --always --dirty --tags --long)
linker_flags = '-X main.buildTime=${current_time} -X main.version=${git_desc}'
## build: build the application
.PHONY: build
build:
@echo 'Building redis-lite'
go build -ldflags=${linker_flags} -o=./redis-lite
.PHONY: cli
cli:
@echo 'Building redis-lite'
go build -ldflags=${linker_flags} -o=./redis-lite-cli cli/main.go