Closed
Description
Abstract
Add a iotest.ErrReader
io.Reader
implementation that reads 0 bytes and fails.
This would be useful for quickly adding test cases for when Read
doesn't work for some reason.
Background
The iotest
package already have a couple of other io.Reader
implementations, but we don't have any that fails right away.
On nearly all codebases I worked in, I created this same failReader
/errReader
implementation. Judging by this and this github searches, I'm not alone.
Proposal
Add it to the standard library, under the iotest
package.
I actually have the PR opened already: #34741
Rationale
Make it easier to add test cases for read failures.