28 lines
744 B
Makefile
28 lines
744 B
Makefile
GO_ZERO_STYLE=go_zero
|
|
GO_CTL_NAME=goctl
|
|
GO ?= go
|
|
GOFMT ?= gofmt "-s"
|
|
GOFILES := $(shell find . -name "*.go")
|
|
LDFLAGS := -s -w
|
|
VERSION="v0.0.2"
|
|
DOCKER_REPO="reg.wang/gateway"
|
|
|
|
|
|
|
|
.PHONY: init-tools
|
|
init-tools: # 產生 api
|
|
go install github.com/zeromicro/go-zero/tools/goctl@v1.8.5
|
|
go install golang.org/x/tools/cmd/goimports@latest
|
|
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
|
|
|
|
|
|
.PHONY: gen-rpc
|
|
gen-rpc: # 建立 rpc code
|
|
$(GO_CTL_NAME) rpc protoc ./generate/rpc/blockchain.proto -m --style=$(GO_ZERO_STYLE) --go_out=./gen_result/pb --go-grpc_out=./gen_result/pb --zrpc_out=.
|
|
go mod tidy
|
|
@echo "Generate core-api files successfully"
|
|
|
|
fmt: # 格式優化
|
|
$(GOFMT) -w $(GOFILES)
|
|
goimports -w ./
|
|
golangci-lint run
|