]> Cypherpunks repositories - gostls13.git/commitdiff
io: make clear that EOF should not be wrapped
authorRuss Cox <rsc@golang.org>
Wed, 30 Sep 2020 19:48:14 +0000 (15:48 -0400)
committerRuss Cox <rsc@golang.org>
Thu, 1 Oct 2020 12:44:21 +0000 (12:44 +0000)
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>
src/io/io.go

index 3dea70b947b71937a31058d2ea53159846259b6f..adc0c0d550a01eb9e8db7f9952f83bcc473c72b2 100644 (file)
@@ -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