-
Notifications
You must be signed in to change notification settings - Fork 18k
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
internal/poll: Write, Pwrite, WriteTo and WriteMsg have different error semantics #19073
Comments
/cc @ianlancetaylor |
Option 3: do nothing. It's an internal API. If you have examples where it affects user code, that's more interesting. |
If we went with option 2, then
Can be rewritten to
I think there is value in pursuing this. |
As far as I can see, the internal/poll package is correctly reflecting the semantics that were implemented for I think it is clear that we can not change the behavior of
The upshot is that all the functions correctly report the number of bytes written on error. It happens that for I don't think there is anything to change. |
Thanks Ian. |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version devel +15c62e8 Mon Feb 13 20:10:19 2017 +0000 darwin/amd64
What operating system and processor architecture are you using (
go env
)?darwin/amd64
What did you do?
Reviewing
fd_unix.go
:fd.Write
returns a non zero count of bytes on error.fd.Pwrite
returns a non zero count of bytes on error.fd.WriteTo
returns zero bytes on error.fd.WriteMsg
returns a non zero count of bytes and a zero count of out of band bytes on error.What did you expect to see?
Option 1: Write,Pwrite,WriteTo, and WriteMsg should return the same count of bytes, that is they all return non zero, or all return zero in the presence of an error.
Option 2: the state of the other values returned from Write,Pwrite,WriteTo, and WriteMsg is not defined in the error condition.
Option 2 is my preferred choice.
What did you see instead?
See above
The text was updated successfully, but these errors were encountered: