-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMakefile
More file actions
35 lines (25 loc) · 719 Bytes
/
Makefile
File metadata and controls
35 lines (25 loc) · 719 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
SHELL := /bin/bash
APP_NAME := giveaway-backend
GO ?= go
GOMOD := $(shell go env GOMOD)
GOFILES := $(shell find . -name "*.go" -not -path "*/vendor/*")
.PHONY: tidy build run test lint goose-up goose-down goose-status migrate-create
tidy:
$(GO) mod tidy
build:
$(GO) build -o bin/$(APP_NAME) ./cmd/api
run:
$(GO) run ./cmd/api
test:
$(GO) test ./...
lint:
golangci-lint run || true
goose-up:
goose -dir ./migrations postgres "$$DATABASE_URL" up
goose-down:
goose -dir ./migrations postgres "$$DATABASE_URL" down
goose-status:
goose -dir ./migrations status
migrate-create:
@test -n "$(name)" || (echo "Usage: make migrate-create name=add_users" && exit 1)
goose -dir ./migrations create $(name) sql