-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
58 lines (43 loc) · 1.3 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
#!make
POSTGRESQL_URL := postgres://postgres:postgres@localhost:5432/master?sslmode=disable
### GO tools
tools:
cd tools && go mod tidy && go mod vendor && go mod verify && go generate -tags tools
.PHONY: tools
vendor:
go mod tidy && go mod vendor && go mod verify
.PHONY: vendor
build:
go build -o ./bin/service ./cmd/service
.PHONY: build
fmt:
go fmt ./cmd/... && go fmt ./internal/...
vet:
go vet ./cmd/... && go vet ./internal/...
imports:
bin/goimports -local github.com/sergeyWh1te/go-template -w -d $(shell find . -type f -name '*.go'| grep -v "/vendor/\|/.git/\|/tools/")
lint:
bin/golangci-lint run --config=.golangci.yml --fix ./cmd... ./internal/...
full-lint: imports fmt vet lint
.PHONY: full-lint
full-lint: imports fmt vet lint
.PHONY: full-lint
### Migrations
.PHONY: rollback
rollback:
bin/migrate -database ${POSTGRESQL_URL} -path db/migrations down
.PHONY: migrate
migrate:
bin/migrate -database ${POSTGRESQL_URL} -path db/migrations up
.PHONY: up
up:
UID_GID="$(id -u):$(id -g)" docker-compose -f docker-compose.yml up -d
.PHONY: up-rebuild
up-rebuild:
UID_GID="$(id -u):$(id -g)" docker-compose -f docker-compose.yml up -d --build <your-project-name>
.PHONY: down
down:
UID_GID="$(id -u):$(id -g)" docker-compose -f docker-compose.yml down
.PHONY: run
run:
make up && make migrate