forked from refiito/pipes-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
66 lines (49 loc) · 1.31 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
59
60
61
62
63
64
65
66
APPNAME=pipes-api
export GOPATH=$(shell pwd)
GOVERSION=$(shell go version | cut -d' ' -f3)
REQUIRED_GOVERSION = $(shell cat .go-version | tr -d '\n')
default: clean build fmt
inittestdb:
- psql -c 'DROP database pipes_test;' -U postgres
psql -c 'CREATE database pipes_test;' -U postgres
psql pipes_test < db/schema.sql
vet:
go vet
test: inittestdb
go test
run: vet fmt
go build -o $(APPNAME) && ./$(APPNAME)
bin/golint:
go get github.com/golang/lint/golint
lint: bin/golint
bin/golint *.go
check_go_version:
@if [ ! "${GOVERSION}" = "go${REQUIRED_GOVERSION}" ]; then echo '\nError: invalid go version, check Makefile'; exit 1; fi
dist_dir:
if [ ! -d "dist" ]; then mkdir -p dist; fi
dist: clean dist_dir check_go_version
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o dist/$(APPNAME)
cp -r config dist/
fmt:
go fmt
build:
go build
clean:
rm -rf $(APPNAME) dist pkg out bin
bin/errcheck:
go get github.com/kisielk/errcheck
errcheck: bin/errcheck
bin/errcheck -ignore 'Close|[wW]rite.*|Flush|Seek|[rR]ead.*|Notify|Rollback'
get:
go get
DEPENDENCY ?= ""
get-dep:
@if [ "$(DEPENDENCY)" != "" ]; then \
rm -fr src/$(DEPENDENCY); \
export GOPATH=`pwd`; \
go get $(DEPENDENCY); \
rm -fr src/$(DEPENDENCY)/.git*; \
else \
echo "usage: DEPENDENCY=github.com/login/pkg make get-dep"; \
exit 1; \
fi