]> Cypherpunks.ru repositories - gostls13.git/commitdiff
bufio: clarify io.EOF behavior of Reader.Read
authorIan Lance Taylor <iant@golang.org>
Mon, 2 May 2022 21:03:07 +0000 (14:03 -0700)
committerGopher Robot <gobot@golang.org>
Mon, 2 May 2022 21:34:37 +0000 (21:34 +0000)
Fixes #52577

Change-Id: Idaff2604979f9a9c1c7d3140c8a5d218fcd27a56
Reviewed-on: https://go-review.googlesource.com/c/go/+/403594
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>

src/bufio/bufio.go

index bcc273c78b28f323bc7f54050abff55732ea13c3..1da8ffa951cc0db9a523e52d1deb39008e4523a6 100644 (file)
@@ -203,7 +203,8 @@ func (b *Reader) Discard(n int) (discarded int, err error) {
 // The bytes are taken from at most one Read on the underlying Reader,
 // hence n may be less than len(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.
+// If the underlying Reader can return a non-zero count with io.EOF,
+// then this Read method can do so as well; see the [io.Reader] docs.
 func (b *Reader) Read(p []byte) (n int, err error) {
        n = len(p)
        if n == 0 {