mirror of
https://github.com/golang/go
synced 2024-11-12 06:20:22 -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:
parent
a50c5fe6c3
commit
a1aee55bd1
@ -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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user