Skip to content
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

don't reimplement io.ReadFull #38

Merged
merged 1 commit into from
Feb 17, 2021
Merged

Conversation

marten-seemann
Copy link
Contributor

From the documentation:

ReadFull reads exactly len(buf) bytes from r into buf. It returns the number of bytes copied and an error if fewer bytes were read. The error is EOF only if no bytes were read. If an EOF happens after reading some but not all the bytes, ReadFull returns ErrUnexpectedEOF. On return, n == len(buf) if and only if err == nil. If r returns an error having read at least len(buf) bytes, the error is dropped.

Not really sure if we need to convert the io.EOF to io.ErrUnexpectedEOF (only happens if n == 0), but this exactly restores the behavior this function had before.

Copy link
Member

@Stebalien Stebalien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ErrUnexpectedEOF is correct.

util.go Outdated Show resolved Hide resolved
@Stebalien
Copy link
Member

non blocking, but @willscott, was there a reason for this?

@willscott
Copy link
Contributor

non blocking, but @willscott, was there a reason for this?

not that I can see. looks like we unintentionally re-implemented io.readfull

@marten-seemann marten-seemann deleted the dont-reimplement-readfull branch February 17, 2021 02:01
@marten-seemann marten-seemann restored the dont-reimplement-readfull branch February 17, 2021 08:55
@marten-seemann
Copy link
Contributor Author

Accidentally deleted the branch, reopening.

@marten-seemann marten-seemann merged commit c8e9b3e into master Feb 17, 2021
@marten-seemann marten-seemann deleted the dont-reimplement-readfull branch February 17, 2021 08:59
@Stebalien Stebalien mentioned this pull request May 11, 2021
27 tasks
@aschmahmann aschmahmann mentioned this pull request May 14, 2021
71 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants