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/product/domain/repository/category.go -destination=./internal/module/product/mock/repository/category.go -package=mock mockgen -source=./internal/module/product/domain/repository/supplementary_info.go -destination=./internal/module/product/mock/repository/supplementary_info.go -package=mock mockgen -source=./internal/module/product/domain/repository/product.go -destination=./internal/module/product/mock/repository/product.go -package=mock mockgen -source=./internal/module/product/domain/repository/tags.go -destination=./internal/module/product/mock/repository/tags.go -package=mock mockgen -source=./internal/module/product/domain/repository/product_item.go -destination=./internal/module/product/mock/repository/product_item.go -package=mock mockgen -source=./internal/module/cart/domain/repository/cart.go -destination=./internal/module/cart/mock/repository/cart.go -package=mock @echo "Generate mock files successfully"