-
Notifications
You must be signed in to change notification settings - Fork 18k
io: should ReadAtLeast and ReadFull guarantee n >= len(buf) => err == nil? #4544
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
Labels
Milestone
Comments
I think we don't need to think about the complexity of ReadFull and ReadAtLeast, because it's only implemented once. I'm more concerned about the complexity of their use. I think lots of Go programs (if not all) all treat non-nil err returned from ReadFull/ReadAtLeast as fatal without paying attention to the n returned. http://tip.golang.org/search?q=_%2C+err+%3A%3D+io.ReadFull shows that there are 52 uses of "_, err := io.ReadFull", which makes this assumption. If we choose to maintain the status quo, we should fix all of them (except tests, perhaps, but please note that of the 52 occurrences, only 9 of them are in package tests). On the contrary, I've tried to fix ReadFull and ReadAtLeast, and one package test failed because, so this might not be backward compatible change (though I argue that they depend on undocumented feature of ReadFull/ReadAtLeast, and we can ignore them). |
This issue was closed by revision 662ff54. Status changed to Fixed. |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The text was updated successfully, but these errors were encountered: