diff options
author | Ian Lance Taylor <iant@golang.org> | 2022-05-02 14:03:07 -0700 |
---|---|---|
committer | Gopher Robot <gobot@golang.org> | 2022-05-02 21:34:37 +0000 |
commit | 99f1bf54eb502e123e60c605212a616146fbe86a (patch) | |
tree | 46d0d89e2d2fc9885a5a9ab2f0d82d0a975f8ea9 /src/bufio | |
parent | a887579976c0f581ca0eb52094b2c5c63893dcdf (diff) | |
download | go-99f1bf54eb502e123e60c605212a616146fbe86a.tar.gz go-99f1bf54eb502e123e60c605212a616146fbe86a.zip |
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 <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>
Diffstat (limited to 'src/bufio')
-rw-r--r-- | src/bufio/bufio.go | 3 |
1 files changed, 2 insertions, 1 deletions
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 { |