Skip to content

Commit 7a90257

Browse files
wkingdmitshur
authored andcommitted
.travis.yml: bump to Go 1.11, use 'gofmt -s' (gregjones#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, gregjones#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
1 parent c63ab54 commit 7a90257

File tree

2 files changed

+15
-16
lines changed

2 files changed

+15
-16
lines changed

‎.travis.yml‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
sudo: false
22
language: go
3-
go:
4-
- 1.6.x
5-
- 1.7.x
6-
- 1.8.x
7-
- 1.9.x
8-
- master
93
matrix:
104
allow_failures:
115
- go: master
126
fast_finish: true
7+
include:
8+
- go: 1.10.x
9+
- go: 1.11.x
10+
env: GOFMT=1
11+
- go: master
1312
install:
1413
- # 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).
1514
script:
1615
- go get -t -v ./...
17-
- diff -u <(echo -n) <(gofmt -d .)
16+
- if test -n "${GOFMT}"; then gofmt -w -s . && git diff --exit-code; fi
1817
- go tool vet .
1918
- go test -v -race ./...

‎httpcache.go‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -416,14 +416,14 @@ func canStaleOnError(respHeaders, reqHeaders http.Header) bool {
416416
func getEndToEndHeaders(respHeaders http.Header) []string {
417417
// These headers are always hop-by-hop
418418
hopByHopHeaders := map[string]struct{}{
419-
"Connection": struct{}{},
420-
"Keep-Alive": struct{}{},
421-
"Proxy-Authenticate": struct{}{},
422-
"Proxy-Authorization": struct{}{},
423-
"Te": struct{}{},
424-
"Trailers": struct{}{},
425-
"Transfer-Encoding": struct{}{},
426-
"Upgrade": struct{}{},
419+
"Connection": {},
420+
"Keep-Alive": {},
421+
"Proxy-Authenticate": {},
422+
"Proxy-Authorization": {},
423+
"Te": {},
424+
"Trailers": {},
425+
"Transfer-Encoding": {},
426+
"Upgrade": {},
427427
}
428428

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

0 commit comments

Comments
 (0)