From 180c9ac049e35c86724cc55da94a310361e92eba Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Sun, 21 Feb 2016 12:59:02 -0500 Subject: [PATCH] `go tool vet --shadow .` --- .travis.yml | 1 + cmux_test.go | 26 ++++++++++++-------------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/.travis.yml b/.travis.yml index d2fab9f..e73780f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,3 +19,4 @@ before_script: - echo $TRAVIS_GO_VERSION - if [[ $TRAVIS_GO_VERSION == 1.5* ]]; then errcheck ./...; fi - go vet . + - go tool vet --shadow . diff --git a/cmux_test.go b/cmux_test.go index 2dde655..24d6249 100644 --- a/cmux_test.go +++ b/cmux_test.go @@ -109,23 +109,21 @@ func runTestHTTPServer(errCh chan<- error, l net.Listener) { } func runTestHTTP1Client(t *testing.T, addr net.Addr) { - r, err := http.Get("http://" + addr.String()) - if err != nil { + if r, err := http.Get("http://" + addr.String()); err != nil { t.Fatal(err) - } - - defer func() { - if err := r.Body.Close(); err != nil { + } else { + defer func() { + if err := r.Body.Close(); err != nil { + t.Fatal(err) + } + }() + if b, err := ioutil.ReadAll(r.Body); err != nil { t.Fatal(err) + } else { + if string(b) != testHTTP1Resp { + t.Fatalf("invalid response: want=%s got=%s", testHTTP1Resp, b) + } } - }() - b, err := ioutil.ReadAll(r.Body) - if err != nil { - t.Fatal(err) - } - - if string(b) != testHTTP1Resp { - t.Errorf("invalid response: want=%s got=%s", testHTTP1Resp, b) } }