A bytes.Buffer only has one embedded slice these days.

Ian Lance Taylor 2019-07-29 16:32:41 -07:00
parent 46e9dc31e2
commit 99bf2690f9

@ -96,8 +96,7 @@ parent trace, etc.
## Copying ## Copying
To avoid unexpected aliasing, be careful when copying a struct from another package. To avoid unexpected aliasing, be careful when copying a struct from another package.
For example, the bytes.Buffer type contains a `[]byte` slice and, as an optimization For example, the bytes.Buffer type contains a `[]byte` slice. If you copy a `Buffer`,
for small strings, a small byte array to which the slice may refer. If you copy a `Buffer`,
the slice in the copy may alias the array in the original, causing subsequent method the slice in the copy may alias the array in the original, causing subsequent method
calls to have surprising effects. calls to have surprising effects.