-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
38 lines (37 loc) · 1.18 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
MSG=$(msg)
IMAGE ?= yusank/godis
TAG ?= latests
BUILDTAGS=$(build_tags)
help: ## Display this help
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[0-9A-Za-z_-]+:.*?##/ { printf " \033[36m%-45s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
.PHONY: server-run
server-run: ## run server as default mode
CGO_ENABLED=0 go run cmd/server/main.go
.PHONY: build-linux
build-linux: ## build server binary for linux
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o go_build_server cmd/server/main.go
.PHONY: lint
lint: ## run golangci-lint for project
golangci-lint run ./... -v
.PHONY: test
test: ## run all test cases
CGO_ENABLED=0 go test -v ./...
.PHONEY: cmt
cmt:## git commit with message
ifeq ($(strip $(MSG)),)
@echo "must input commit msg"
exit 1
endif
git add .
git commit -m '$(MSG)'
@echo "msg:$(MSG)"
.PHONEY: gen_cmd
gen_cmd: ## gen redis cmd code
cd cmd/gen_redis_cmd && go install
go generate ./...
.PHONEY: clean
clean: ## clean all generated code
rm -rf redis/*.cmd.go
.PHONEY: docker-build
docker-build: ## build docker image
docker build --build-arg build_tags=$(BUILDTAGS) -t $(IMAGE):$(TAG) .