diff options
Diffstat (limited to 'src/strings/builder.go')
| -rw-r--r-- | src/strings/builder.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/strings/builder.go b/src/strings/builder.go index e6df08c6f4..7ecef3176b 100644 --- a/src/strings/builder.go +++ b/src/strings/builder.go @@ -23,6 +23,12 @@ type Builder struct { buf []byte } +// copyCheck implements a dynamic check to prevent modification after +// copying a non-zero Builder, which would be unsafe (see #25907, #47276). +// +// We cannot add a noCopy field to Builder, to cause vet's copylocks +// check to report copying, because copylocks cannot reliably +// discriminate the zero and nonzero cases. func (b *Builder) copyCheck() { if b.addr == nil { // This hack works around a failing of Go's escape analysis |
