-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
51 lines (37 loc) · 951 Bytes
/
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
.PHONY: all
all: setup build fmt vet lint test
APP=recipes-app
GLIDE_NOVENDOR=$(shell glide novendor)
ALL_PACKAGES=$(shell go list ./... | grep -v "vendor")
UNIT_TEST_PACKAGES=$(shell glide novendor | grep -v "featuretests")
APP_EXECUTABLE="./out/$(APP)"
setup:
go get -u github.com/golang/lint/golint
go get github.com/DATA-DOG/godog/cmd/godog
build-deps:
glide install
update-deps:
glide update
compile:
mkdir -p out/
go build -o $(APP_EXECUTABLE)
build: build-deps compile
install:
go install ./...
fmt:
go fmt $(GLIDE_NOVENDOR)
vet:
go vet $(GLIDE_NOVENDOR)
lint:
@for p in $(UNIT_TEST_PACKAGES); do \
echo "==> Linting $$p"; \
golint $$p | { grep -vwE "exported (var|function|method|type|const) \S+ should have comment" || true; } \
done
test: db.migrate
ENVIRONMENT=test go test $(UNIT_TEST_PACKAGES) -p=1
db.migrate:
$(APP_EXECUTABLE) migrate
db.rollback:
$(APP_EXECUTABLE) rollback
run:
$(APP_EXECUTABLE) start