mirror of
https://github.com/golang/go
synced 2024-09-29 01:24:34 -06:00
Revert "io: detect Writers that access io.Copy's buffer after returning"
This reverts CL 466865. Reason for revert: Causing trybot flakiness due to net/http race, roll back until net/http is fixed. For #58168 Change-Id: I3129deb996abe6466eccf933fe93cbbaf72ae217 Reviewed-on: https://go-review.googlesource.com/c/go/+/467895 TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Damien Neil <dneil@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Damien Neil <dneil@google.com>
This commit is contained in:
parent
0cd309e128
commit
b146d7626f
@ -14,7 +14,6 @@ package io
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"internal/race"
|
||||
"sync"
|
||||
)
|
||||
|
||||
@ -428,14 +427,6 @@ func copyBuffer(dst Writer, src Reader, buf []byte) (written int64, err error) {
|
||||
nr, er := src.Read(buf)
|
||||
if nr > 0 {
|
||||
nw, ew := dst.Write(buf[0:nr])
|
||||
if race.Enabled {
|
||||
// Write over the buffer to help the race detector
|
||||
// detect Write calls that access the buffer after returning.
|
||||
// Use something other than zeros to make errors more obvious.
|
||||
for i := range buf[:nr] {
|
||||
buf[i] = 0xdd
|
||||
}
|
||||
}
|
||||
if nw < 0 || nr < nw {
|
||||
nw = 0
|
||||
if ew == nil {
|
||||
|
Loading…
Reference in New Issue
Block a user