forked from goadesign/plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplugins.mk
38 lines (32 loc) · 979 Bytes
/
plugins.mk
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
# Common Makefile rules for plugins
#
# Include this file in all the plugins Makefile as follows
#
# include $(GOPATH)/src/goa.design/plugins/plugins.mk
#
# Targets:
# - "depend" retrieves the Go packages needed to run the linter and tests
# - "lint" runs the linter and checks the code format using goimports
# - "test" runs the tests
PLUGIN_DIR=goa.design/plugins
DEPEND=\
github.com/sergi/go-diff/diffmatchpatch \
github.com/golang/lint/golint \
golang.org/x/tools/cmd/goimports \
goa.design/goa/...
all: depend test lint
depend:
@go get -t -v ./...
@go get -v $(DEPEND)
test:
@go test ./...
lint:
$(eval DIRS := $(shell go list -f {{.Dir}} ./...))
@for d in $(DIRS) ; do \
if [ "`goimports -l $$d/*.go | tee /dev/stderr`" ]; then \
echo "^ - Repo contains improperly formatted go files" && echo && exit 1; \
fi \
done
@if [ "`golint ./... | grep -vf .golint_exclude | tee /dev/stderr`" ]; then \
echo "^ - Lint errors!" && echo && exit 1; \
fi