-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
60 lines (44 loc) · 1.28 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
55
56
57
58
59
MAKEFLAGS += --no-builtin-rules
MAKEFLAGS += --no-builtin-variables
.PHONY: build
build:
mkdir -p build
go build -mod=readonly -v -o build/ .
.PHONY: generate
generate:
buf generate protos
.PHONY: test
test:
go test -v ./... ./example/...
.PHONY: example
example: build
buf --debug generate --template buf.example.gen.yaml --path example/bookstore
buf --debug generate --template buf.example.gen.yaml --path example/webhooks
.PHONY: example_oas_lint
example_oas_lint:
podman run -v $(CURDIR)/example/bookstore/v1:/spec --rm docker.io/p1c2u/openapi-spec-validator /spec/bookstore.pb.bookstore_service.oas31.yaml
vacuum lint -d example/bookstore/v1/bookstore.pb.bookstore_service.oas31.yaml
.PHONY: fmt
fmt:
buf format -w
.PHONY: lint
lint:
buf lint ./protos
GOMOD_DIRS := . ./example ./apigw ./routers/ginapi
ADDDEP_TARGET := $(addprefix adddep_, $(GOMOD_DIRS))
UPDATEDEP_TARGET := $(addprefix updatedep_, $(GOMOD_DIRS))
${ADDDEP_TARGET}:
cd $(@:adddep_%=%) && go mod tidy -v
${UPDATEDEP_TARGET}:
cd $(@:updatedep_%=%) && go get -d -u ./...
cd $(@:updatedep_%=%) && go mod tidy -v
.PHONY: $(ADDDEP_TARGET)
adddep: $(ADDDEP_TARGET)
go mod vendor
# .PHONY: adddep
# adddep:
# go mod tidy -v
# go mod vendor
.PHONY: ${UPDATEDEP_TARGET}
updatedeps: ${UPDATEDEP_TARGET}
go mod vendor