- Notifications
You must be signed in to change notification settings - Fork331
Open
Labels
Description
*bufio.Scanner and other consumers ofio.Reader interface expect to receiveio.EOF identically when reading to the end of a file/stream.
From the io package:
// 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
// giving more detail.
var EOF = errors.New("EOF")
We currently wrapEOF along with any other error when reading fromnetConn ormsgReader. Instead, we should returnio.EOF identically to conform with theio.Reader spec.