-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
54 lines (42 loc) · 1.16 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
BIN_SRC=cmd/main.go
DIST_DIR=.dist
LOG_FILE=*.log*
##################################
####### Setup ########
##################################
.PHONY: ensure tidy
tidy:
@go mod tidy
ensure: tidy
@go mod download
##################################
####### Tool ########
##################################
.PHONY: fmt lint build clean api
API_PATH = "./service/api/example.api"
API_DIR = "./service/api"
API_TEMPLATE = "./.goctl"
SWAGGER_GEN_DIR = "./gen/swagger"
ifeq ($(shell uname),Darwin)
CMD = gsed
else
CMD = sed
endif
api:
go install github.com/zeromicro/go-zero/tools/goctl@latest
goctl api format --dir ${API_DIR} --declare
goctl api go --api ${API_PATH} --dir ${API_DIR}
find * -type f -exec ${CMD} -i 's/^\s\+$$//g' {} +
##################################
####### Migrate ########
##################################
.PHONY: migrations migrate sqlmigrate
SCHEMA_DIR=./spec/schema
SCHEMA_DIR=./spec/schema
migrations:
go install entgo.io/ent/cmd/ent@v0.14.1
ent generate --feature sql/upsert --target gen/entschema ${SCHEMA_DIR}
migrate:
@go run ${BIN_SRC} migrate
sqlmigrate:
@go run ${BIN_SRC} migrate --fake