1
0
mirror of https://github.com/golang/go synced 2024-11-12 08:10:21 -07:00

bufio: put notes about len(p) together

CL 145577 added the part about io.ReadFull to read len(p)
but it should be next to the existing sentence about not
reading len(p) bytes.

Change-Id: Idfa037c59a3085d44d5da6129188473db0e96d23
Reviewed-on: https://go-review.googlesource.com/c/148903
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
This commit is contained in:
Russ Cox 2018-11-12 11:36:12 -05:00
parent ee55f0856a
commit de50ea3cd8

View File

@ -186,9 +186,8 @@ func (b *Reader) Discard(n int) (discarded int, err error) {
// It returns the number of bytes read into p. // It returns the number of bytes read into p.
// The bytes are taken from at most one Read on the underlying Reader, // The bytes are taken from at most one Read on the underlying Reader,
// hence n may be less than len(p). // hence n may be less than len(p).
// At EOF, the count will be zero and err will be io.EOF.
//
// To read exactly len(p) bytes, use io.ReadFull(b, p). // To read exactly len(p) bytes, use io.ReadFull(b, p).
// At EOF, the count will be zero and err will be io.EOF.
func (b *Reader) Read(p []byte) (n int, err error) { func (b *Reader) Read(p []byte) (n int, err error) {
n = len(p) n = len(p)
if n == 0 { if n == 0 {