Permalink
Browse files

.travis.yml: bump to Go 1.11, use 'gofmt -s' (#92)

* .travis.yml: Bump to modern Go (1.11)

Go 1.11 came out in August [1], which means Go 1.9 and earlier are no
longer supported [2].  Just test on supported versions.

[1]: https://golang.org/doc/devel/release.html#go1.11
[2]: https://golang.org/doc/devel/release.html#policy

* Revert "Remove simplify-code option, for now"

This reverts commit be6978e (Remove
simplify-code option, for now, 2016-03-12, #40).  I expect this was
due to a simplification change between Go versions (the commit message
doesn't say), but none of the versions which we were using back then
are supported any more.

* httpcache: Update gofmt

Generated with:

  $ gofmt -s -w *.go */*.go

using:

  $ go version
  go version go1.11.2 linux/amd64

* .travis.yml: Only run 'gofmt' on 1.11.x

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 authored and dmitshur committed Feb 3, 2019
1 parent c63ab54 commit 7a902570cb17174de4ac788094f8ebedec136f57
Showing with 15 additions and 16 deletions.
  1. +6 −7 .travis.yml
  2. +9 −9 httpcache.go
@@ -1,19 +1,18 @@
sudo: false
language: go
go:
- 1.6.x
- 1.7.x
- 1.8.x
- 1.9.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 .)
- if test -n "${GOFMT}"; then gofmt -w -s . && git diff --exit-code; fi
- go tool vet .
- go test -v -race ./...
@@ -416,14 +416,14 @@ func canStaleOnError(respHeaders, reqHeaders http.Header) bool {
func getEndToEndHeaders(respHeaders http.Header) []string {
// These headers are always hop-by-hop
hopByHopHeaders := map[string]struct{}{
"Connection": struct{}{},
"Keep-Alive": struct{}{},
"Proxy-Authenticate": struct{}{},
"Proxy-Authorization": struct{}{},
"Te": struct{}{},
"Trailers": struct{}{},
"Transfer-Encoding": struct{}{},
"Upgrade": struct{}{},
"Connection": {},
"Keep-Alive": {},
"Proxy-Authenticate": {},
"Proxy-Authorization": {},
"Te": {},
"Trailers": {},
"Transfer-Encoding": {},
"Upgrade": {},
}

for _, extra := range strings.Split(respHeaders.Get("connection"), ",") {
@@ -433,7 +433,7 @@ func getEndToEndHeaders(respHeaders http.Header) []string {
}
}
endToEndHeaders := []string{}
for respHeader, _ := range respHeaders {
for respHeader := range respHeaders {
if _, ok := hopByHopHeaders[respHeader]; !ok {
endToEndHeaders = append(endToEndHeaders, respHeader)
}

0 comments on commit 7a90257

Please sign in to comment.