Skip to content

Commit d0b944a

Browse files
cryptobiozmcanevet
authored andcommitted
Add imports lint and vet to Makefile
1 parent 43d52de commit d0b944a

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

Makefile

+17-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
DEPS = $(wildcard */*.go)
22
VERSION = $(shell git describe --always --dirty)
33

4-
all: prometheus-puppetdb prometheus-puppetdb.1
4+
all: imports lint vet prometheus-puppetdb prometheus-puppetdb.1
55

66
prometheus-puppetdb: main.go $(DEPS)
77
CGO_ENABLED=0 GOOS=linux \
@@ -16,4 +16,19 @@ prometheus-puppetdb.1: prometheus-puppetdb
1616
clean:
1717
rm -f prometheus-puppetdb prometheus-puppetdb.1
1818

19-
.PHONY: all clean
19+
lint:
20+
@ go get -v github.com/golang/lint/golint
21+
@for file in $$(git ls-files '*.go' | grep -v '_workspace/'); do \
22+
export output="$$(golint $${file} | grep -v 'type name will be used as docker.DockerInfo')"; \
23+
[ -n "$${output}" ] && echo "$${output}" && export status=1; \
24+
done; \
25+
exit $${status:-0}
26+
27+
vet: main.go
28+
go vet $<
29+
30+
imports: main.go
31+
dep ensure -vendor-only
32+
goimports -d $<
33+
34+
.PHONY: all lint clean

0 commit comments

Comments
 (0)