2
0
mirror of https://github.com/soheilhy/cmux.git synced 2024-09-20 11:05:48 +08:00

Merge pull request #18 from tamird/vet-shadow

`go tool vet --shadow .`
This commit is contained in:
Soheil Hassas Yeganeh 2016-02-25 12:04:36 -05:00
commit d8cc6481fa
2 changed files with 13 additions and 14 deletions

View File

@ -19,3 +19,4 @@ before_script:
- echo $TRAVIS_GO_VERSION - echo $TRAVIS_GO_VERSION
- if [[ $TRAVIS_GO_VERSION == 1.5* ]]; then errcheck ./...; fi - if [[ $TRAVIS_GO_VERSION == 1.5* ]]; then errcheck ./...; fi
- go vet . - go vet .
- go tool vet --shadow .

View File

@ -109,23 +109,21 @@ func runTestHTTPServer(errCh chan<- error, l net.Listener) {
} }
func runTestHTTP1Client(t *testing.T, addr net.Addr) { func runTestHTTP1Client(t *testing.T, addr net.Addr) {
r, err := http.Get("http://" + addr.String()) if r, err := http.Get("http://" + addr.String()); err != nil {
if err != nil {
t.Fatal(err) t.Fatal(err)
} } else {
defer func() {
defer func() { if err := r.Body.Close(); err != nil {
if err := r.Body.Close(); err != nil { t.Fatal(err)
}
}()
if b, err := ioutil.ReadAll(r.Body); err != nil {
t.Fatal(err) 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)
} }
} }