-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
48 lines (34 loc) · 1.08 KB
/
Copy pathMakefile
File metadata and controls
48 lines (34 loc) · 1.08 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
# Import .env
ifneq (,$(wildcard ./.env))
include .env
export
endif
cmd-exists-%:
@hash $(*) > /dev/null 2>&1 || \
(echo "ERROR: '$(*)' must be installed and available on your PATH."; exit 1)
psql: cmd-exists-psql
psql "${DATABASE_URL}"
server:
go run main.go
test:
go test -v -cover ./...
testcover:
go test ./... -coverprofile=cover.out
testview:
go tool cover -html=cover.out
swaginstall:
go get -u github.com/swaggo/swag/cmd/swag
swag:
swag init
migrateinstall:
curl -L https://packagecloud.io/golang-migrate/migrate/gpgkey | apt-key add -
echo "deb https://packagecloud.io/golang-migrate/migrate/ubuntu/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/migrate.list
apt-get update
apt-get install -y migrate
migrationscreate:
# migrate create -ext sql -dir ./databases/migrations -seq init_schema
migrateup:
migrate -path ./databases/migrations/ -database "${DATABASE_URL}" -verbose up
migratedown:
migrate -path ./databases/migrations/ -database "${DATABASE_URL}" -verbose down
.PHONY: server test testcover testview swaginstall swag migrateinstall psql