On Thu, Jul 29, 2021 at 4:35 AM 'Dan Kortschak' via golang-nuts <golang-nuts@googlegroups.com> wrote: > > I just noticed today that the io.Closer docs say that "The behavior of > Close after the first call is undefined. Specific implementations may > document their own behavior". > > Should this be "unspecified" rather than "undefined"?
The general concern here is that if there is something like a file descriptor involved, and if the Close method doesn't take special protection to avoid problems with multiple calls to Close, then a first call to Close may close the descriptor, then some other goroutine may open something and get the same descriptor number, and then a second call to Close may close the same descriptor number, breaking the other goroutine unexpectedly. Historically, we forgot to say that it was OK to call Close multiple times. By the time we wrote that comment, there were many existing Close implementations out there, and it wasn't clear that we wanted to, or reasonably could, make them non-compliant. So unfortunately I think we kind of do mean "undefined". Ian -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAOyqgcVGnB0FwaAV8yxM_0uh_NXLK5NbPufAsswsTuxYg1C99A%40mail.gmail.com.