OSDN Git Service

versoin1.1.9 (#594)
[bytom/vapor.git] / vendor / github.com / gin-gonic / gin / Makefile
1 GOFMT ?= gofmt "-s"
2 PACKAGES ?= $(shell go list ./... | grep -v /vendor/)
3 VETPACKAGES ?= $(shell go list ./... | grep -v /vendor/ | grep -v /examples/)
4 GOFILES := $(shell find . -name "*.go" -type f -not -path "./vendor/*")
5
6 all: install
7
8 install: deps
9         govendor sync
10
11 .PHONY: test
12 test:
13         sh coverage.sh
14
15 .PHONY: fmt
16 fmt:
17         $(GOFMT) -w $(GOFILES)
18
19 .PHONY: fmt-check
20 fmt-check:
21         # get all go files and run go fmt on them
22         @diff=$$($(GOFMT) -d $(GOFILES)); \
23         if [ -n "$$diff" ]; then \
24                 echo "Please run 'make fmt' and commit the result:"; \
25                 echo "$${diff}"; \
26                 exit 1; \
27         fi;
28
29 vet:
30         go vet $(VETPACKAGES)
31
32 deps:
33         @hash govendor > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
34                 go get -u github.com/kardianos/govendor; \
35         fi
36         @hash embedmd > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
37                 go get -u github.com/campoy/embedmd; \
38         fi
39
40 embedmd:
41         embedmd -d *.md
42
43 .PHONY: lint
44 lint:
45         @hash golint > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
46                 go get -u github.com/golang/lint/golint; \
47         fi
48         for PKG in $(PACKAGES); do golint -set_exit_status $$PKG || exit 1; done;
49
50 .PHONY: misspell-check
51 misspell-check:
52         @hash misspell > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
53                 go get -u github.com/client9/misspell/cmd/misspell; \
54         fi
55         misspell -error $(GOFILES)
56
57 .PHONY: misspell
58 misspell:
59         @hash misspell > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
60                 go get -u github.com/client9/misspell/cmd/misspell; \
61         fi
62         misspell -w $(GOFILES)