Hi Dan,
io.EOF and io.ErrUnexpectedEOF are very different errors.
The difference is that io.EOF is a "clean EOF" at a proper
I/O boundary (from the level of abstraction of the reader that
returned it), while io.ErrUnexpectedEOF is a mid-record EOF.
The former is an ordinary thing to expect and the latter usually
indicates some kind of data corruption. It would be a problem
for the standard library to not allow using errors.Is to distinguish
these two. (And we want to preserve the rule that errors.Is is
a drop-in unwrapping replacement for ==. We can't make it a
condition of adopting errors.Is that these two errors are now
blurred together.)
I'm not surprised that nothing breaks in the main tree if
you arrange to blur the two since there is not much code in the
main tree that:
- unwraps or distinguishes errors at all
- uses errors.Is
- runs in contexts where ErrUnexpectedEOF happens
But I would expect subtle problems to crop up in higher-level
applications. Merging these two errors is not something we
should do as a default.
Best,
Russ