From 54cd96d2fb7ee7325fd4a8782d2393fde780c02f Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Sat, 19 Mar 2016 12:27:56 +0000 Subject: [PATCH] travis: add go1.6 and work around golint closes #350 Signed-off-by: Vincent Batts --- .travis.yml | 5 +++-- Makefile | 8 ++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5e1b19df..97f0dcf7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,6 @@ language: go go: + - 1.6 - 1.5.3 - 1.4.3 - 1.3.3 @@ -8,13 +9,13 @@ sudo: false before_install: - go get golang.org/x/tools/cmd/vet - - go get github.com/golang/lint/golint + - go version | (grep -q 'go1.[56]' || exit 0 && go get -u github.com/golang/lint/golint ) - go get github.com/vbatts/git-validation install: true script: - go vet -x ./... - - $HOME/gopath/bin/golint ./... + - make .golint - $HOME/gopath/bin/git-validation -run DCO,short-subject -v -range ${TRAVIS_COMMIT_RANGE} diff --git a/Makefile b/Makefile index 17877657..e93e72c4 100644 --- a/Makefile +++ b/Makefile @@ -40,6 +40,11 @@ html: vbatts/pandoc -f markdown_github -t html5 -o /output/docs.html $(patsubst %,/input/%,$(DOC_FILES)) && \ ls -sh $(shell readlink -f output/docs.html) + +HOST_GOLANG_VERSION = $(shell go version | cut -d ' ' -f3 | cut -c 3-) +# this variable is used like a function. First arg is the minimum version, Second arg is the version to be checked. +ALLOWED_GO_VERSION = $(shell test '$(shell /bin/echo -e "$(1)\n$(2)" | sort -V | head -n1)' == '$(1)' && echo 'true') + .PHONY: test .govet .golint .gitvalidation test: .govet .golint .gitvalidation @@ -50,7 +55,10 @@ test: .govet .golint .gitvalidation # `go get github.com/golang/lint/golint` .golint: +ifeq ($(call ALLOWED_GO_VERSION,1.5,$(HOST_GOLANG_VERSION)),true) golint ./... +endif + # `go get github.com/vbatts/git-validation` .gitvalidation: