Skip to content
This repository has been archived by the owner on Apr 20, 2023. It is now read-only.

Commit

Permalink
.travis.yml: Only run 'gofmt' on 1.11.x
Browse files Browse the repository at this point in the history
The indent heuristic changed with Go 1.11 [1], so there's no single
form that satisfies gofmt for both Go 1.10 and Go 1.11.  With this
commit, we now only run gofmt on 1.11.

Docs for the 'include' syntax are in [2].

Also replace the double-diff with a 'gofmt -w ...' to write the
changes and a 'git diff ...' call to display the changes and exit
non-zero if there were any.

[1]: https://golang.org/doc/go1.11#gofmt
[2]: https://docs.travis-ci.com/user/customizing-the-build/#explicitly-including-jobs
  • Loading branch information
wking committed Nov 7, 2018
1 parent 921ad4e commit d5cd581
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
sudo: false
language: go
go:
- 1.10.x
- 1.11.x
- master
matrix:
allow_failures:
- go: master
fast_finish: true
include:
- go: 1.10.x
- go: 1.11.x
env: GOFMT=1
- go: master
install:
- # Do nothing. This is needed to prevent default install action "go get -t -v ./..." from happening here (we want it to happen inside script step).
script:
- go get -t -v ./...
- diff -u <(echo -n) <(gofmt -d -s .)
- if test -n "${GOFMT}"; then gofmt -w -s . && git diff --exit-code; fi
- go tool vet .
- go test -v -race ./...

0 comments on commit d5cd581

Please sign in to comment.