From: Russ Cox Date: Wed, 30 Sep 2020 19:48:14 +0000 (-0400) Subject: io: make clear that EOF should not be wrapped X-Git-Tag: go1.16beta1~882 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=9b1518aeda297f87d6d06218ddb744c71fefb80d;p=gostls13.git 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 Reviewed-by: Rob Pike --- 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