@iliana@cybre.space For bonus points, did you know that the `Addr` may not actually be what it's listening on?
That is to say, the following code can panic in some cases:
conn, err := net.Listen("tcp", ":8080")
if err != nil {
log.Fatal("couldn't listen")
}
_, err = net.Dial("tcp", conn.Addr().String())
if err != nil {
panic("this does happen in some cases")
}
For anyone curious about the details, it's basically "ipv6" https://github.com/moby/moby/issues/33099
In go's defence, the behaviour was fixed in go1.9, so it probably can't panic anymore (whoops, didn't realize that until I looked it up now) https://github.com/golang/go/issues/18806