Description
The documentation for http.Transport warns:
By default, Transport caches connections for future re-use. This may leave many open connections when accessing many hosts. This behavior can be managed using Transport's CloseIdleConnections method and the MaxIdleConnsPerHost and DisableKeepAlives fields.
For users of the API, it may not be obvious that the idle connections may remain open even after the Transport
becomes unreachable and is garbage-collected.
It would be nice if the zero-value Transport represented a configuration that did not leak connections. Better still if we could find a way to automatically close the idle connections when the Transport becomes unreachable.
I don't think this is fixable in Go 1, but we should revisit this aspect of the API if/when we're thinking about Go 2.