In Go, interfaces that use resources like network connections usually have a Close()
method that disposes of these resources.
Now I wonder what would happen if the associated structs implementing the interface get garbage-collected without Close
having been invoked.
Will the OS keep the network connection / file descriptor / whatever open? Will the garbage collector do something or will something even prevent it from touching that struct?
I.e.
conn, _ := net.DialTCP(network, laddr, raddr)
// do stuff, then
conn = nil
// forgot to invoke `Close()`!!
// what happens now?