-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
34 lines (23 loc) · 809 Bytes
/
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
.PHONY: clean all init generate generate_mocks
all: build/main
build/main: cmd/main.go generated
@echo "Building..."
go build -o $@ $<
clean:
rm -rf generated
init: generate
go mod tidy
go mod vendor
test:
go test -short -coverprofile coverage.out -v ./...
generate: generated generate_mocks
generated: api.yml
@echo "Generating files..."
mkdir generated || true
oapi-codegen --package generated -generate types,server,spec $< > generated/api.gen.go
INTERFACES_GO_FILES := $(shell find repository -name "interfaces.go")
INTERFACES_GEN_GO_FILES := $(INTERFACES_GO_FILES:%.go=%.mock.gen.go)
generate_mocks: $(INTERFACES_GEN_GO_FILES)
$(INTERFACES_GEN_GO_FILES): %.mock.gen.go: %.go
@echo "Generating mocks $@ for $<"
mockgen -source=$< -destination=$@ -package=$(shell basename $(dir $<))