-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
79 lines (54 loc) · 1.77 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
.PHONY: local run build test
# ==============================================================================
# Go migrate postgresql
force:
migrate -database postgresql://gabriel:leirbag123@localhost:5432/users?sslmode=disable -path migrations force 1
version:
migrate -database postgresql://gabriel:leirbag123@localhost:5432/users?sslmode=disable -path migrations version 1
migrate-up:
migrate -database postgresql://gabriel:leirbag123@localhost:5432/users?sslmode=disable -path migrations up 1
migrate-down:
migrate -database postgresql://gabriel:leirbag123@localhost:5432/users?sslmode=disable -path migrations down 1
# ==============================================================================
# Docker compose commands
local:
echo "Starting local environment"
docker-compose -f docker-compose.local.yml up -d
local-down:
echo "Deleting local environment"
docker-compose -f docker-compose.local.yml down -v
# ==============================================================================
# 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
# ==============================================================================
# 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)