
GOMETALINTER_ARGS ?= --vendor --dupl-threshold=150 --min-confidence=.3 --tests --deadline=90s --disable-all \
	-Egolint -Etest -Eineffassign -Etestify -Eunconvert -Estaticcheck -Egoconst -Egocyclo -Eerrcheck \
	-Egofmt -Evet -Edupl -Einterfacer -Estructcheck -Evetshadow -Egosimple -Egoimports -Evarcheck -Emisspell \
	-Ealigncheck -Etest --exclude=/usr/local/go/src --exclude='/mocks/[^/]+\.go.*\(dupl\)' ./...

build:
	./build.sh

test:
	go test -race $$(go list ./... | grep -v /vendor/)

setup_lint:
	go get -u golang.org/x/tools/cmd/goimports github.com/wadey/gocovmerge github.com/alecthomas/gometalinter
	gometalinter --install
	# Print some debug stuff so we can know why the build is failing
	echo $(PATH)
	which go
	which gcc
	go version
	which gometalinter

jenkins: setup_lint build test lint
	echo "hello world jenkins done"

lint:
	gometalinter $(GOMETALINTER_ARGS)

fix:
	find . -iname '*.go' -not -path '*/vendor/*' -print0 | xargs -0 gofmt -s -w
	find . -iname '*.go' -not -path '*/vendor/*' -print0 | xargs -0 goimports -w

revendor:
	dep ensure
	dep prune
