Thanks all. I opened this issue:

    https://github.com/golang/go/issues/23556

(The reason I'm using SetNonblock is that before Go 1.9, it wasn't safe to
call file.Close() if another goroutine was reading/writing to the pipe. But
now that it's safe with Go 1.9, I can re-organize my code and remove the
SetNonblock calls.)

David

On Thu, Jan 25, 2018 at 9:34 AM, Peter Mogensen <[email protected]> wrote:

>
>
> On 2018-01-25 16:18, Ian Lance Taylor wrote:
> > On Thu, Jan 25, 2018 at 7:04 AM, Max <[email protected]>
> wrote:
> >> Also, os.File.Fd() having side effects seems very unexpected and
> surprising
> >> at least to me.
>
> .File() on a network conn have had that effect.
>
> > 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."
>
> Better docs would be great. I recall spending a lot of time figuring
> this out.
> I had the need to do .File().Fd() on a network socket.
>  - not to do any operations on it, but just to keep a dup(2) around
> until the original FD was closed.
>
> So the solution ended up being doing SetNonblock() ... but it was not
> easy to see from the docs.
>
> /Peter
>
> --
> 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.
>

-- 
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.

Reply via email to