From: Ian Lance Taylor Date: Mon, 2 May 2022 21:03:07 +0000 (-0700) Subject: bufio: clarify io.EOF behavior of Reader.Read X-Git-Tag: go1.19beta1~485 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=99f1bf54eb502e123e60c605212a616146fbe86a;p=gostls13.git bufio: clarify io.EOF behavior of Reader.Read Fixes #52577 Change-Id: Idaff2604979f9a9c1c7d3140c8a5d218fcd27a56 Reviewed-on: https://go-review.googlesource.com/c/go/+/403594 Reviewed-by: Joseph Tsai Reviewed-by: Ian Lance Taylor Auto-Submit: Ian Lance Taylor Reviewed-by: Bryan Mills Run-TryBot: Ian Lance Taylor TryBot-Result: Gopher Robot Run-TryBot: Ian Lance Taylor --- diff --git a/src/bufio/bufio.go b/src/bufio/bufio.go index bcc273c78b..1da8ffa951 100644 --- a/src/bufio/bufio.go +++ b/src/bufio/bufio.go @@ -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 {