37 lines
870 B
Makefile
Executable File
37 lines
870 B
Makefile
Executable File
GO_CTL_NAME=goctl
|
|
|
|
# go-zero 生成風格
|
|
GO_ZERO_STYLE=go_zero
|
|
|
|
GO ?= go
|
|
GOFMT ?= gofmt "-s"
|
|
GOFILES := $(shell find . -name "*.go")
|
|
LDFLAGS := -s -w
|
|
VERSION="v1.0.1"
|
|
DOCKER_REPO="igs170911/feed"
|
|
|
|
.PHONY: test
|
|
test: # 進行測試
|
|
go test -v --cover ./...
|
|
|
|
.PHONY: fmt
|
|
fmt: # 格式優化
|
|
$(GOFMT) -w $(GOFILES)
|
|
goimports -w ./
|
|
golangci-lint run
|
|
|
|
.PHONY: gen-swagger
|
|
gen-swagger: # 格式優化
|
|
goctl api plugin -plugin goctl-swagger="swagger -filename url.json -host 127.0.0.1:8888" -api ./generate/api/url_generate.api -dir .
|
|
|
|
.PHONY: gen-api
|
|
gen-api: # 產生 api
|
|
goctl api go -api ./generate/api/url_generate.api -dir . -style go_zero
|
|
|
|
|
|
|
|
.PHONY: mock-gen
|
|
mock-gen: # 建立 mock 資料
|
|
mockgen -source=./internal/module/url/repository/url.go -destination=./internal/module/url//mock/repository/url.go -package=mock
|
|
@echo "Generate mock files successfully"
|