aboutsummaryrefslogtreecommitdiff
path: root/src/io
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2020-09-30 15:48:14 -0400
committerRuss Cox <rsc@golang.org>2020-10-01 12:44:21 +0000
commit9b1518aeda297f87d6d06218ddb744c71fefb80d (patch)
treec907b7d8dde062ec088ef60424a541024b5ef5cb /src/io
parentb8ec1d5f49ec5f9350f2b0bd99560e4aadfcb70c (diff)
downloadgo-9b1518aeda297f87d6d06218ddb744c71fefb80d.tar.gz
go-9b1518aeda297f87d6d06218ddb744c71fefb80d.zip
io: make clear that EOF should not be wrapped
For #40827. Change-Id: Ifd108421abd8d0988dd7b985e4f9e2bd5356964a Reviewed-on: https://go-review.googlesource.com/c/go/+/258524 Trust: Russ Cox <rsc@golang.org> Reviewed-by: Rob Pike <r@golang.org>
Diffstat (limited to 'src/io')
-rw-r--r--src/io/io.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/io/io.go b/src/io/io.go
index 3dea70b947..adc0c0d550 100644
--- a/src/io/io.go
+++ b/src/io/io.go
@@ -31,6 +31,8 @@ var ErrShortWrite = errors.New("short write")
var ErrShortBuffer = errors.New("short buffer")
// EOF is the error returned by Read when no more input is available.
+// (Read must return EOF itself, not an error wrapping EOF,
+// because callers will test for EOF using ==.)
// Functions should return EOF only to signal a graceful end of input.
// If the EOF occurs unexpectedly in a structured data stream,
// the appropriate error is either ErrUnexpectedEOF or some other error