From 8bc61693bf8a6ab31abfb79ae2dbf897af9f49fe Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Sun, 7 Oct 2018 13:59:29 +0900 Subject: [PATCH] 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. --- .travis.yml | 17 ++++++++++------- Makefile | 13 +++++++++++-- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index d2ea1d120..1922f6d01 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/Makefile b/Makefile index 2c7b4aa2f..f8427ce8d 100644 --- a/Makefile +++ b/Makefile @@ -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