-
Notifications
You must be signed in to change notification settings - Fork 9
/
Makefile
46 lines (35 loc) · 1.04 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
include api/api.mk
include demo/demo.mk
.DEFAULT_GOAL := help
.PHONY: help
setup:
go install golang.org/x/tools/cmd/goimports@latest
go install honnef.co/go/tools/cmd/staticcheck@latest
go install github.com/pressly/goose/v3/cmd/goose@latest
go get ./...
(cd api && npm i)
build: ## Installs and compiles dependencies
go build -v ./...
run: ## Start dev mode
make db-up
go run main.go
test:
go test ./... -v -cover -p 1
lint:
go fmt ./...
goimports -l -w .
staticcheck ./...
go vet ./...
include ./pkg/conf/dev.env
DB_DSN:="host=$(POSTGRES_HOST) user=$(POSTGRES_USER) password=$(POSTGRES_PASSWORD) dbname=$(POSTGRES_DB) port=$(POSTGRES_PORT) sslmode=disable"
MIGRATE_OPTIONS=-allow-missing -dir="./sql"
db-up: ## Migrate down on database
goose -v $(MIGRATE_OPTIONS) postgres $(DB_DSN) up
db-down: ## Migrate up on database
goose -v $(MIGRATE_OPTIONS) postgres $(DB_DSN) reset
db-rebuild: ## Reset the database
make db-down
make db-up
help:
grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
| sed -n 's/^\(.*\): \(.*\)##\(.*\)/\1\3/p'