-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
63 lines (47 loc) · 1.04 KB
/
Makefile
File metadata and controls
63 lines (47 loc) · 1.04 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
include .env
export
# variables
BINARY_NAME=api
MAIN_PATH=./cmd/api
DB_URL=$(DATABASE_URL)
# build
build:
go build -o bin/$(BINARY_NAME) $(MAIN_PATH)
# run
run:
go run $(MAIN_PATH)
# dev
dev:
air
# test
test:
go test ./... -v
# test with coverage
test-coverage:
go test ./... -coverprofile=coverage.out
go tool cover -html=coverage.out
# lint
lint:
golangci-lint run ./...
# migrations
migrate-up:
goose -dir ./internal/sql/schema postgres "$(DB_URL)" up
migrate-down:
goose -dir ./internal/sql/schema postgres "$(DB_URL)" down
migrate-reset:
goose -dir ./internal/sql/schema postgres "$(DB_URL)" reset
migrate-status:
goose -dir ./internal/sql/schema postgres "$(DB_URL)" status
migrate-create:
goose -dir ./internal/sql/schema create $(name) sql
# sqlc
sqlc:
sqlc generate
# swagger
swagger:
swag init -g $(MAIN_PATH)/main.go -o ./docs
# clean
clean:
rm -f bin/$(BINARY_NAME)
rm -f coverage.out
.PHONY: build run dev test test-coverage lint migrate-up migrate-down migrate-reset migrate-status migrate-create sqlc swagger clean