-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
os: File.Read(nil) with os.O_WRONLY behavior change in tip #19122
Comments
This is because with the recent changes to make the os package use the runtime poller, the os package has now picked up the special behavior on
The comment is correct unless the descriptor is only opened for writing. There are couple of ways we could fix this, but I think my first question is: does it really matter? What is the purpose of calling |
Thank you for your answer.
My app needs to emulate C's stdio buffer. And current implementation is something like:
Then, I need to generate the error for ReadXXX in woFile. |
You could also simply record in your own data structure whether the file was opened write-only or not. That is what the standard library would have to do to change this. I think the question is whether that needs to be in the standard library or not. We've never really documented the behavior of |
Unfortunately, I need real system call error messages.
I assume the impact is very small. But I'm not sure... Please feel free to close the issue anytime. |
Closing. Can reopen if someone else has similar trouble. |
Thank you for your responses! |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version devel +0ad247c Thu Feb 16 04:35:36 2017 +0000 darwin/amd64
go version go1.8rc3 darwin/amd64
go version go1.7.3 darwin/amd64
go version go1.5.4 darwin/amd64
What operating system and processor architecture are you using (
go env
)?What did you do?
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
What did you expect to see?
for all versions.
What did you see instead?
for tip.
On the other hand, f.Write(nil) on
os.O_RDONLY
always return the error.The text was updated successfully, but these errors were encountered: