2
0
mirror of https://github.com/soheilhy/cmux.git synced 2024-11-10 11:41:52 +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) t.Fatal(err)
} }
}() }()
b, err := ioutil.ReadAll(r.Body) if b, err := ioutil.ReadAll(r.Body); err != nil {
if err != nil {
t.Fatal(err) t.Fatal(err)
} } else {
if string(b) != testHTTP1Resp { if string(b) != testHTTP1Resp {
t.Errorf("invalid response: want=%s got=%s", testHTTP1Resp, b) t.Fatalf("invalid response: want=%s got=%s", testHTTP1Resp, b)
}
}
} }
} }