Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

In the stdlib Go code for file.Close, it doesn't actually do the syscall after the first call to Close, so there's your language guarantee.

That is a scary sounding error though.



Older versions of go (1.0 for example ) were much less safe. I had a look at the code, and it closes the file directly, and marks it as unusable. However, if you do concurrent operations, you can race and close twice the underlying fd - which I think was my bug ( I shouldn’t have been closing things twice anyway !)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: