-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
55 lines (41 loc) · 1.35 KB
/
Makefile
File metadata and controls
55 lines (41 loc) · 1.35 KB
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
ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
.PHONY:
.SILENT:
build:
go build -v -o bin/server cmd/server/main.go
go build -v -o bin/migrator cmd/migrator/main.go
go build -v -o bin/generator cmd/generator/main.go
test:
go test -v -race ./...
# --- development only ---
swagger_serve:
docker run \
-p 8882:8080 \
-e SWAGGER_JSON=/doc/swagger.yml \
-v $(ROOT_DIR)/api/swagger.yml:/doc/swagger.yml \
swaggerapi/swagger-ui
mockgen:
mockgen -source=internal/service/interfaces.go \
-mock_names=pacService=PacService,RuleRepository=RuleRepository,ProxyProfileRepository=ProxyProfileRepository \
-destination=internal/service/mock/mock.go \
-package=mock
mockgen -source=internal/handler/interfaces.go \
-mock_names=RuleService=RuleService,ProxyProfileService=ProxyProfileService \
-destination=internal/handler/mock/mock.go \
-package=mock
lint:
docker run --rm -it -v $(ROOT_DIR):/app -w /app golangci/golangci-lint:v1.49.0 golangci-lint run -v -E gofmt
build_img:
docker build --no-cache -t pacgen:latest .
serve:
go run cmd/server/main.go
generate_pac:
go run cmd/generator/main.go
create_migration:
docker run \
-v $(ROOT_DIR)/migrations:/migrations \
migrate/migrate create -dir migrations -ext sql -seq $(name)
migrate_up:
go run cmd/migrator/main.go up
migrate_down:
go run cmd/migrator/main.go down