On Thu, Jan 25, 2018 at 7:04 AM, Max <[email protected]> wrote: > > Thanks for the explanation and the solution :) > > Where is this behaviour documented? > > The current documentation https://golang.org/pkg/os does not indicate > blocking vs non blocking behaviour of *os.File and of functions that return > *os.File, as for example os.Pipe() > > Also, os.File.Fd() having side effects seems very unexpected and surprising > at least to me.
I found it very difficult to write fully correct documentation for this. Explaining it overwhelmed the important points with detail that is irrelevant to 99.9% of users. All that is there at the moment is the docs on the Fd method that say "On Unix systems this will cause the SetDeadline methods to stop working." I'm certainly open to suggestions but anything added has to be very short and very clear. Adding a sentence like "the file descriptor is returned in blocking mode" leads you into a rathole of trying to explain which files are blocking and which are not, and what that even means in a language like Go. More broadly, the general guideline is always going to be to not try to flip back and forth between the os package and the syscall package. Pick one or the other. When you need to switch, use Fd or NewFIle, once. 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
