forked from rafecolton/go-fileutils
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
56 lines (44 loc) · 1000 Bytes
/
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
SHELL := /bin/bash
SUDO ?= sudo
DOCKER ?= docker
F := github.com/modcloth/go-fileutils
TARGETS := $(F)
GINKGO_PATH ?= "."
export GINKGO_PATH
default: test
.PHONY: all
all: clean build test
.PHONY: clean
clean:
go clean -i -r $(TARGETS) || true
.PHONY: test
test: fmtpolice
.PHONY: deps
deps:
go get github.com/golang/lint/golint
.PHONY: fmtpolice
fmtpolice: deps fmt lint
.PHONY: fmt
fmt:
@echo "----------"
@echo "checking fmt"
@set -e ; \
for f in $(shell git ls-files '*.go'); do \
gofmt $$f | diff -u $$f - ; \
done
.PHONY: linter
linter:
go get github.com/golang/lint/golint
.PHONY: lint
lint: linter
@echo "----------"
@echo "checking lint"
@for file in $(shell git ls-files '*.go') ; do \
if [[ "$$($(GOPATH)/bin/golint $$file)" =~ ^[[:blank:]]*$$ ]] ; then \
echo yayyy >/dev/null ; \
else $(MAKE) lintv && exit 1 ; fi \
done
.PHONY: lintv
lintv:
@echo "----------"
@for file in $(shell git ls-files '*.go') ; do $(GOPATH)/bin/golint $$file ; done