build: update build file to exclude go 1.10 from linting

In this commit, we modify our build file to only lint under go 1.11. We
do this as there's been a breaking change in gofmt between go 1.10 and
go 1.11 that causes files which pass the linter under go 1.10, to fail
the linter under go 1.11. In the end, we only really need to lint using
one version of go.

In order to achieve this, we "unroll" the build matrix to enumerate each
version and the environment variables that it should be run with. We
then modify the Makefile to only include the lint directive if the
particular env variable is set ($(USE_LINT)). With these two changes,
we'll now only lint under go 1.11.
This commit is contained in:
Olaoluwa Osuntokun 2018-10-07 13:59:29 +09:00
parent d8e6085c17
commit 8bc61693bf
No known key found for this signature in database
GPG Key ID: CE58F7F8E20FD9A2
2 changed files with 21 additions and 9 deletions

@ -1,17 +1,20 @@
language: go
go:
- "1.10"
- "1.11"
matrix:
include:
- go: "1.11"
env: RACE=FALSE USE_LINT=TRUE
- go: "1.11"
env: RACE=FALSE USE_LINT=TRUE
- go: "1.10"
env: RACE=TRUE USE_LINT=FALSE
- go: "1.10"
env: RACE=FALSE USE_LINT=FALSE
sudo: required
install:
- sudo add-apt-repository -y ppa:bitcoin/bitcoin -y
- sudo apt-get update -q
- sudo apt-get install bitcoind -y
- export PATH=$PATH:$PWD/linux-amd64/
env:
matrix:
- RACE=false
- RACE=true
script:
- export PATH=$PATH:$GOPATH/bin
- make travis

@ -182,16 +182,25 @@ flake-unit:
# TRAVIS
# ======
ifeq ($(RACE), false)
ifeq ($(RACE)$(USE_LINT), FALSETRUE)
travis: dep lint build itest unit-cover $(GOVERALLS_BIN)
@$(call print, "Sending coverage report.")
$(GOVERALLS_BIN) -coverprofile=profile.cov -service=travis-ci
endif
ifeq ($(RACE), true)
ifeq ($(RACE)$(USE_LINT), FALSEFALSE)
travis: dep build itest unit-cover $(GOVERALLS_BIN)
@$(call print, "Sending coverage report.")
$(GOVERALLS_BIN) -coverprofile=profile.cov -service=travis-ci
endif
ifeq ($(RACE)$(USE_LINT), TRUETRUE)
travis: dep lint btcd unit-race
endif
ifeq ($(RACE)$(USE_LINT), TRUEFALSE)
travis: dep btcd unit-race
endif
# =========
# UTILITIES