Skip to content

Commit 691faa0

Browse files
author
Mrunal Patel
committed
Merge pull request #352 from vbatts/go-version-golint
travis: add go1.6 and work around golint
2 parents 7aa7dcd + 54cd96d commit 691faa0

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

.travis.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
language: go
22
go:
3+
- 1.6
34
- 1.5.3
45
- 1.4.3
56
- 1.3.3
@@ -8,13 +9,13 @@ sudo: false
89

910
before_install:
1011
- go get golang.org/x/tools/cmd/vet
11-
- go get github.com/golang/lint/golint
12+
- go version | (grep -q 'go1.[56]' || exit 0 && go get -u github.com/golang/lint/golint )
1213
- go get github.com/vbatts/git-validation
1314

1415
install: true
1516

1617
script:
1718
- go vet -x ./...
18-
- $HOME/gopath/bin/golint ./...
19+
- make .golint
1920
- $HOME/gopath/bin/git-validation -run DCO,short-subject -v -range ${TRAVIS_COMMIT_RANGE}
2021

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ html:
4040
vbatts/pandoc -f markdown_github -t html5 -o /output/docs.html $(patsubst %,/input/%,$(DOC_FILES)) && \
4141
ls -sh $(shell readlink -f output/docs.html)
4242

43+
44+
HOST_GOLANG_VERSION = $(shell go version | cut -d ' ' -f3 | cut -c 3-)
45+
# this variable is used like a function. First arg is the minimum version, Second arg is the version to be checked.
46+
ALLOWED_GO_VERSION = $(shell test '$(shell /bin/echo -e "$(1)\n$(2)" | sort -V | head -n1)' == '$(1)' && echo 'true')
47+
4348
.PHONY: test .govet .golint .gitvalidation
4449

4550
test: .govet .golint .gitvalidation
@@ -50,7 +55,10 @@ test: .govet .golint .gitvalidation
5055

5156
# `go get github.com/golang/lint/golint`
5257
.golint:
58+
ifeq ($(call ALLOWED_GO_VERSION,1.5,$(HOST_GOLANG_VERSION)),true)
5359
golint ./...
60+
endif
61+
5462

5563
# `go get github.com/vbatts/git-validation`
5664
.gitvalidation:

0 commit comments

Comments
 (0)