mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
bytes: note that NewBuffer take ownership of its argument
Fixes #19383 Change-Id: Ic84517053ced7794006f6fc65e6f249e97d6cf35 Reviewed-on: https://go-review.googlesource.com/44691 Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
c82a6307f4
commit
29469d2406
1 changed files with 6 additions and 4 deletions
|
|
@ -441,10 +441,12 @@ func (b *Buffer) ReadString(delim byte) (line string, err error) {
|
||||||
return string(slice), err
|
return string(slice), err
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewBuffer creates and initializes a new Buffer using buf as its initial
|
// NewBuffer creates and initializes a new Buffer using buf as its
|
||||||
// contents. It is intended to prepare a Buffer to read existing data. It
|
// initial contents. The new Buffer takes ownership of buf, and the
|
||||||
// can also be used to size the internal buffer for writing. To do that,
|
// caller should not use buf after this call. NewBuffer is intended to
|
||||||
// buf should have the desired capacity but a length of zero.
|
// prepare a Buffer to read existing data. It can also be used to size
|
||||||
|
// the internal buffer for writing. To do that, buf should have the
|
||||||
|
// desired capacity but a length of zero.
|
||||||
//
|
//
|
||||||
// In most cases, new(Buffer) (or just declaring a Buffer variable) is
|
// In most cases, new(Buffer) (or just declaring a Buffer variable) is
|
||||||
// sufficient to initialize a Buffer.
|
// sufficient to initialize a Buffer.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue