-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CidFromReader should not wrap valid EOF return. #151
Conversation
When reading from an io.Reader that has no data, the io.EOF error should not be wrapped in ErrInvalidCid. This is not an invalid CID, and is not the same as a partial read which is indicated by io.ErrUnexpectedEOF. This fix is needed because existing code that uses CidFromReader may check for the end of an input stream by `if err == io.EOF` instead of the preferred `if errors.Is(err, io.EOF)`, and that code break at runtime after upgrading to go-cid v0.4.0.
This is a tough call, arguably |
Unfortunately I can't suggest inline for the godoc comment because it's too far out of the diff, but here's what I suggest for clearning up that:
|
Co-authored-by: Rod Vagg <rod@vagg.org>
@rvagg Added test for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice
Suggested version: Changes in (empty)
Cutting a Release (and modifying non-markdown files)This PR is modifying both Automatically created GitHub ReleaseA draft GitHub Release has been created. |
When reading from an
io.Reader
that has no data, theio.EOF
error should not be wrapped inErrInvalidCid
. This is not an invalid CID, and is not the same as a partial read which is indicated byio.ErrUnexpectedEOF
.This fix is needed because existing code that uses
CidFromReader
may check for the end of an input stream byif err == io.EOF
instead of the preferredif errors.Is(err, io.EOF)
, and that code will break at runtime after upgrading to go-cid v0.4.0.Fixes #152