diff --git a/Makefile b/Makefile index b7cc10892..fd8451959 100644 --- a/Makefile +++ b/Makefile @@ -6,23 +6,35 @@ default: moby DEPS=$(wildcard cmd/moby/*.go) Makefile PREFIX?=/usr/local -moby: $(DEPS) lint +GOLINT:=$(shell command -v golint 2> /dev/null) +INEFFASSIGN:=$(shell command -v ineffassign 2> /dev/null) + +moby: $(DEPS) go build --ldflags "-X main.GitCommit=$(GIT_COMMIT) -X main.Version=$(VERSION)" -o $@ github.com/moby/tool/cmd/moby -.PHONY: lint +.PHONY: lint: +ifndef GOLINT + $(error "Please install golint! go get -u github.com/tool/lint") +endif +ifndef INEFFASSIGN + $(error "Please install ineffassign! go get -u github.com/gordonklaus/ineffassign") +endif # golint @test -z "$(shell find . -type f -name "*.go" -not -path "./vendor/*" -not -name "*.pb.*" -exec golint {} \; | tee /dev/stderr)" # gofmt @test -z "$$(gofmt -s -l .| grep -v .pb. | grep -v vendor/ | tee /dev/stderr)" + # ineffassign + @test -z $(find . -type f -name "*.go" -not -path "*/vendor/*" -not -name "*.pb.*" -exec ineffassign {} \; | tee /dev/stderr) ifeq ($(GOOS),) # govet @test -z "$$(go tool vet -printf=false . 2>&1 | grep -v vendor/ | tee /dev/stderr)" - # go test - @go test github.com/moby/tool/src/moby endif -test: moby +test: lint moby + # go test + @go test github.com/moby/tool/src/moby + # test build ./moby build -output tar test/test.yml rm moby test.tar diff --git a/circle.yml b/circle.yml index 93d250722..c59cee98b 100644 --- a/circle.yml +++ b/circle.yml @@ -8,6 +8,7 @@ jobs: steps: - checkout - run: go get github.com/golang/lint/golint + - run: go get github.com/gordonklaus/ineffassign - run: cd $GOPATH/src/github.com/moby/tool && make test - - run: cd $GOPATH/src/github.com/moby/tool && make clean && make GOOS=darwin - - run: cd $GOPATH/src/github.com/moby/tool && make clean && make GOOS=windows + - run: cd $GOPATH/src/github.com/moby/tool && make clean && make GOOS=darwin lint moby + - run: cd $GOPATH/src/github.com/moby/tool && make clean && make GOOS=windows lint moby