4 ms·
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 sou
by dlock17 2y ago
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.
- Agingcoder 2y agoOlder 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 !)