forked from allegro/akubra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
54 lines (43 loc) · 1.15 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
VERSION := `git log -n 1 | grep commit | sed 's/commit //g' | head -n 1`
LDFLAGS := -X main.version=$(VERSION)
GO := "$(GOROOT)/bin/go"
all: vars formatting lint test build
vars:
@echo "====== Makefile internal variables:"
@echo "VERSION: '$(VERSION)'"
@echo "LDFLAGS: '$(LDFLAGS)'"
@echo "GO: '$(GO)'"
@echo "======\n\n"
linux: vars formatting lint test
GOOS=linux $(GO) build -v -ldflags "$(LDFLAGS)" -tags 'netcgo=1'.
formatting:
$(GO) get golang.org/x/tools/cmd/goimports
lint: deps-lint
gometalinter ./... \
--disable=gotype \
--disable=dupl \
--disable=gosec \
--deadline=600s \
--disable=goimports \
--vendor \
--fast
lint-slow: deps-lint
gometalinter ./... \
--disable=gotype \
--disable=dupl \
--deadline=600s \
--enable=goimports \
--vendor
deps:
$(GO) get github.com/Masterminds/glide
glide install
deps-lint: deps
$(GO) get github.com/alecthomas/gometalinter
gometalinter --install
build: vars deps lint
# Enable netcgo, then name resolution will use systems dns caches
$(GO) build -v -ldflags "$(LDFLAGS)" -tags 'netcgo=1'.
test: deps
$(GO) test -v -race -cover $$(go list ./... | grep -v /vendor/)
clean:
$(GO) clean .