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) } }