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

The implementation of `os.File.Close()` in Go clears the file descriptor.

https://pkg.go.dev/os#File.Close

“Close will return an error if it has already been called.”

An os.File is a data structure containing a file descriptor and some other fields. It is safe to call Close() multiple times, because it will only call the underlying syscall close() once.



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

Search: