Skip to content
Myr

refactor(Makefile): allow overriding default go program (#1593)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Bo-Yi Wu · committed by 田欧 · parent 268e307 · Browse files · 2 files+18 added−23 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+18 added−23 removed

  • other:+18 added−23 removed

2 files+18 added−23 removed

deleted:coverage.sh-13 removed
modified:Makefile+18 added-10 removed
1GO ?= go2GOFMT ?= gofmt "-s"2PACKAGES ?= $(shell go list ./... | grep -v /vendor/)3VETPACKAGES ?= $(shell go list ./... | grep -v /vendor/ | grep -v /examples/)3PACKAGES ?= $(shell $(GO) list ./... | grep -v /vendor/)4VETPACKAGES ?= $(shell $(GO) list ./... | grep -v /vendor/ | grep -v /examples/)5GOFILES := $(shell find . -name "*.go" -type f -not -path "./vendor/*")6TESTFOLDER := $(shell $(GO) list ./... | grep -E 'gin$$|binding$$|render$$' | grep -v examples)78all: install910install: deps11 govendor sync1213.PHONY: test14test:13 sh coverage.sh15 echo "mode: count" > coverage.out16 for d in $(TESTFOLDER); do \17 $(GO) test -v -covermode=count -coverprofile=profile.out $$d; \18 if [ -f profile.out ]; then \19 cat profile.out | grep -v "mode:" >> coverage.out; \20 rm profile.out; \21 fi; \22 done2324.PHONY: fmt25fmt:26 $(GOFMT) -w $(GOFILES)2728.PHONY: fmt-check29fmt-check:21 # get all go files and run go fmt on them30 @diff=$$($(GOFMT) -d $(GOFILES)); \31 if [ -n "$$diff" ]; then \32 echo "Please run 'make fmt' and commit the result:"; \33 echo "$${diff}"; \34 exit 1; \35 fi;3637vet:30 go vet $(VETPACKAGES)38 $(GO) vet $(VETPACKAGES)3940deps:41 @hash govendor > /dev/null 2>&1; if [ $$? -ne 0 ]; then \34 go get -u github.com/kardianos/govendor; \42 $(GO) get -u github.com/kardianos/govendor; \43 fi44 @hash embedmd > /dev/null 2>&1; if [ $$? -ne 0 ]; then \37 go get -u github.com/campoy/embedmd; \45 $(GO) get -u github.com/campoy/embedmd; \46 fi4748embedmd:49 embedmd -d *.md5051.PHONY: lint52lint:53 @hash golint > /dev/null 2>&1; if [ $$? -ne 0 ]; then \46 go get -u golang.org/x/lint/golint; \54 $(GO) get -u golang.org/x/lint/golint; \55 fi56 for PKG in $(PACKAGES); do golint -set_exit_status $$PKG || exit 1; done;5758.PHONY: misspell-check59misspell-check:60 @hash misspell > /dev/null 2>&1; if [ $$? -ne 0 ]; then \53 go get -u github.com/client9/misspell/cmd/misspell; \61 $(GO) get -u github.com/client9/misspell/cmd/misspell; \62 fi63 misspell -error $(GOFILES)6465.PHONY: misspell66misspell:67 @hash misspell > /dev/null 2>&1; if [ $$? -ne 0 ]; then \60 go get -u github.com/client9/misspell/cmd/misspell; \68 $(GO) get -u github.com/client9/misspell/cmd/misspell; \69 fi70 misspell -w $(GOFILES)