On Monday, September 11, 2017 at 10:24:39 PM UTC-4, Dave Cheney wrote: > > What about this ? > > https://play.golang.org/p/qmi1MvLBm8 > > I believe this code is incorrect. Here's a demonstration:
https://gist.github.com/slingamn/1467b1bafc613aec7ca0276c31a7a37f/revisions The original revision is taken from the Go Playground snippet, the second revision makes the code compile, and the third revision adds a sleep (which should not make correct code into incorrect code) and a re-bind after the `Close()` call. On my system (Go 1.9 on Linux x86_64), the third revision reliably panics with: `panic: listen tcp :6502: bind: address already in use` The question I'm really asking is not so much how to write code that works in practice (or, rather, appears to do so), but how to be certain (on the basis of the specification and API documentation) that the code is correct. -- 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. For more options, visit https://groups.google.com/d/optout.