-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
50 lines (35 loc) · 989 Bytes
/
Copy pathMakefile
File metadata and controls
50 lines (35 loc) · 989 Bytes
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
-include .env
export
MIGRATE_CMD=migrate -path ./migrations -database ${DATABASE_URL}
GOFILES_WITHOUT_VENDOR=$(shell find . -type f -name '*.go' -not -path "./vendor/*")
run:
go run cmd/main.go
clean:
rm bin -r || true
build: clean
go build -v -o bin/main ./cmd
test:
go test -v ./...
test_coverage:
go test -race -coverprofile=coverage.out -covermode=atomic ./... && \
go tool cover -html=coverage.out -o coverage.html
up:
docker compose up -d
down:
docker compose down
migrate_create:
migrate create -ext sql -dir ./migrations -seq ${NAME}
migrate_up:
${MIGRATE_CMD} up
migrate_down:
${MIGRATE_CMD} down 1
lint:
@if [ -n "$$(gofmt -l ${GOFILES_WITHOUT_VENDOR})" ]; \
then echo 'Forgot to run "make lint_fix"?' && exit 1; \
fi
lint_fix:
@gofmt -l -w ${GOFILES_WITHOUT_VENDOR}
check_swagger_install:
which swagger || go get -u github.com/go-swagger/go-swagger/cmd/swagger
swagger: check_swagger_install
swagger generate spec -o ./swagger.yml --scan-models