32 lines
840 B
Makefile
32 lines
840 B
Makefile
|
# go-zero 生成風格
|
||
|
GO_ZERO_STYLE=go_zero
|
||
|
GO ?= go
|
||
|
GOFMT ?= gofmt "-s"
|
||
|
GOFILES := $(shell find . -name "*.go")
|
||
|
LDFLAGS := -s -w
|
||
|
VERSION="v1.0.4"
|
||
|
DOCKER_REPO="igs170911/comment"
|
||
|
GIT_COMMIT ?= $(shell git rev-parse --short HEAD)
|
||
|
|
||
|
.PHONY: test
|
||
|
test: # 進行測試
|
||
|
go test -v --cover ./...
|
||
|
|
||
|
.PHONY: fmt
|
||
|
fmt: # 格式優化
|
||
|
$(GOFMT) -w $(GOFILES)
|
||
|
goimports -w ./
|
||
|
golangci-lint run
|
||
|
|
||
|
.PHONY: gen-rpc
|
||
|
gen-rpc: # 建立 rpc code
|
||
|
goctl rpc protoc ./generate/protobuf/comment.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"
|
||
|
|
||
|
.PHONY: mock-gen
|
||
|
mock-gen: # 建立 mock 資料
|
||
|
mockgen -source=./pkg/domain/repository/comment.go -destination=./pkg/mock/repository/comment.go -package=mock
|
||
|
|
||
|
@echo "Generate mock files successfully"
|