net/http: don't ignore some errors in tests
to help debug Issue 2651
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5644049
diff --git a/src/pkg/net/http/transport_test.go b/src/pkg/net/http/transport_test.go
index 321da52..caf81d6 100644
--- a/src/pkg/net/http/transport_test.go
+++ b/src/pkg/net/http/transport_test.go
@@ -441,7 +441,11 @@
}
if accept == "gzip" {
rw.Header().Set("Content-Encoding", "gzip")
- gz, _ := gzip.NewWriter(rw)
+ gz, err := gzip.NewWriter(rw)
+ if err != nil {
+ t.Errorf("gzip NewWriter: %v", err)
+ return
+ }
gz.Write([]byte(responseBody))
gz.Close()
} else {
@@ -460,7 +464,11 @@
res, err := DefaultTransport.RoundTrip(req)
var body []byte
if test.compressed {
- gzip, _ := gzip.NewReader(res.Body)
+ gzip, err := gzip.NewReader(res.Body)
+ if err != nil {
+ t.Errorf("%d. gzip NewReader: %v", i, err)
+ continue
+ }
body, err = ioutil.ReadAll(gzip)
res.Body.Close()
} else {