The documentation for io.EOF specifically indicates it should be used for graceful end-of-stream operations, and that io.ErrUnexpectedEOF should be used when more data was expected.
As such, I'd hope/expect the above playground link to print "unexpected EOF" rather than just "EOF".
This would allow me to distinguish between, for example, streamed reads where there is literally no more data available (we hit EOF before reading any bytes), versus a case where we read some bytes, but could not successfully parse the value.
codec returns io.EOF upon receiving truncated/incomplete data:
https://go.dev/play/p/retXRYuAszH
The documentation for
io.EOF
specifically indicates it should be used for graceful end-of-stream operations, and thatio.ErrUnexpectedEOF
should be used when more data was expected.As such, I'd hope/expect the above playground link to print "unexpected EOF" rather than just "EOF".
This would allow me to distinguish between, for example, streamed reads where there is literally no more data available (we hit EOF before reading any bytes), versus a case where we read some bytes, but could not successfully parse the value.