-
Notifications
You must be signed in to change notification settings - Fork 150
/
Makefile
99 lines (67 loc) · 2.23 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
.PHONY: migrate migrate_down migrate_up migrate_version docker prod docker_delve local swaggo test
# ==============================================================================
# Go migrate postgresql
force:
migrate -database postgres://postgres:postgres@localhost:5432/auth_db?sslmode=disable -path migrations force 1
version:
migrate -database postgres://postgres:postgres@localhost:5432/auth_db?sslmode=disable -path migrations version
migrate_up:
migrate -database postgres://postgres:postgres@localhost:5432/auth_db?sslmode=disable -path migrations up 1
migrate_down:
migrate -database postgres://postgres:postgres@localhost:5432/auth_db?sslmode=disable -path migrations down 1
# ==============================================================================
# Docker compose commands
develop:
echo "Starting docker environment"
docker-compose -f docker-compose.dev.yml up --build
docker_delve:
echo "Starting docker debug environment"
docker-compose -f docker-compose.delve.yml up --build
prod:
echo "Starting docker prod environment"
docker-compose -f docker-compose.prod.yml up --build
local:
echo "Starting local environment"
docker-compose -f docker-compose.local.yml up --build
# ==============================================================================
# Tools commands
run-linter:
echo "Starting linters"
golangci-lint run ./...
swaggo:
echo "Starting swagger generating"
swag init -g **/**/*.go
# ==============================================================================
# Main
run:
go run ./cmd/api/main.go
build:
go build ./cmd/api/main.go
test:
go test -cover ./...
# ==============================================================================
# Modules support
deps-reset:
git checkout -- go.mod
go mod tidy
go mod vendor
tidy:
go mod tidy
go mod vendor
deps-upgrade:
# go get $(go list -f '{{if not (or .Main .Indirect)}}{{.Path}}{{end}}' -m all)
go get -u -t -d -v ./...
go mod tidy
go mod vendor
deps-cleancache:
go clean -modcache
# ==============================================================================
# Docker support
FILES := $(shell docker ps -aq)
down-local:
docker stop $(FILES)
docker rm $(FILES)
clean:
docker system prune -f
logs-local:
docker logs -f $(FILES)