This repository was archived by the owner on Jan 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
74 lines (54 loc) · 1.72 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
67
68
69
70
71
72
73
74
CMD=promulgate
VERSION?=$(shell git describe --tags --dirty | sed 's/^v//')
GO_BUILD=CGO_ENABLED=0 go build -i --ldflags="-w -X $(shell go list)/version=$(VERSION)"
rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) \
$(filter $(subst *,%,$2),$d))
LINTERS=\
gofmt \
golint \
vet \
misspell \
ineffassign \
deadcode
all: ci
ci: $(LINTERS) bootstrap vendor build
.PHONY: all ci
# ################################################
# Bootstrapping for base golang package deps
# ################################################
CMD_PKGS=\
github.com/golang/lint/golint \
github.com/dominikh/go-tools/simple \
github.com/client9/misspell/cmd/misspell \
github.com/gordonklaus/ineffassign \
github.com/tsenart/deadcode \
github.com/alecthomas/gometalinter
define VENDOR_BIN_TMPL
vendor/bin/$(notdir $(1)): vendor
go build -o $$@ ./vendor/$(1)
VENDOR_BINS += vendor/bin/$(notdir $(1))
endef
$(foreach cmd_pkg,$(CMD_PKGS),$(eval $(call VENDOR_BIN_TMPL,$(cmd_pkg))))
$(patsubst %,%-bin,$(filter-out gofmt vet,$(LINTERS))): %-bin: vendor/bin/%
gofmt-bin vet-bin:
bootstrap:
which dep || go get -u github.com/golang/dep/cmd/dep
vendor: Gopkg.lock
dep ensure
.PHONY: bootstrap $(CMD_PKGS)
# ################################################
# Test and linting
# ###############################################
$(LINTERS): %: vendor/bin/gometalinter %-bin vendor
PATH=`pwd`/vendor/bin:$$PATH gometalinter --tests --disable-all --vendor \
--deadline=5m -s data ./... --enable $@
.PHONY: $(LINTERS)
# ################################################
# Building
# ###############################################$
LISTBOT_DEPS=\
vendor
build: $(LISTBOT_DEPS)
$(GO_BUILD) -o bin/listbot .
heroku: build
.PHONY: build