-
Notifications
You must be signed in to change notification settings - Fork 34
/
plugins.mk
30 lines (27 loc) · 907 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
# Common Makefile rules for plugins
#
# Include this file in all the plugins Makefile as follows
#
# include ../plugins.mk
#
# Each plugin Makefile may define the following targets:
#
# - gen: generate the plugin code
# - build-examples: build the plugin examples binaries
# - clean: clean the plugin examples binaries
#
# Targets:
# - "all" calls "gen", "test", "lint", "build-examples" and "clean"
# - "lint" runs the linter and checks the code format using goimports
# - "test" runs the tests
all: gen test lint build-examples clean
test:
@go test ./...
lint:
$(eval GO_FILES := $(shell find . -type f -name '*.go'))
@if [ "`goimports -l $(GO_FILES) | tee /dev/stderr`" ]; then \
echo "^ - Repo contains improperly formatted go files" && echo && exit 1; \
fi
@if [ "`staticcheck ./... | grep -vf .golint_exclude | tee /dev/stderr`" ]; then \
echo "^ - Lint errors!" && echo && exit 1; \
fi