1
0
mirror of https://github.com/golang/go synced 2024-11-23 23:10:09 -07:00

net/http: close body in benchmarks

Is it required? Why don't we do it?

R=bradfitz
CC=golang-codereviews
https://golang.org/cl/61150043
This commit is contained in:
Dmitriy Vyukov 2014-02-17 06:04:31 +04:00
parent a50c5fe6c3
commit a1aee55bd1

View File

@ -2258,7 +2258,9 @@ func BenchmarkClientServer(b *testing.B) {
if err != nil {
b.Fatal("Get:", err)
}
defer res.Body.Close()
all, err := ioutil.ReadAll(res.Body)
res.Body.Close()
if err != nil {
b.Fatal("ReadAll:", err)
}
@ -2301,6 +2303,7 @@ func benchmarkClientServerParallel(b *testing.B, conc int) {
continue
}
all, err := ioutil.ReadAll(res.Body)
res.Body.Close()
if err != nil {
b.Logf("ReadAll: %v", err)
continue
@ -2338,6 +2341,7 @@ func BenchmarkServer(b *testing.B) {
log.Panicf("Get: %v", err)
}
all, err := ioutil.ReadAll(res.Body)
res.Body.Close()
if err != nil {
log.Panicf("ReadAll: %v", err)
}