Hi All!
I'm having trouble understanding whether a new http.Client{} with no
Transport set will use a new copy of DefaultTransport, or the global?
>From client.go:
func (c *Client) transport() RoundTripper {
if c.Transport != nil {
return c.Transport
}
return DefaultTransport
}
DefaultTransport's definition from transport.go, as a pointer to a
Transport struct:
var DefaultTransport RoundTripper = &Transport{
Proxy: ProxyFromEnvironment,
DialContext: (&net.Dialer{
Timeout: 30 * time.Second,
KeepAlive: 30 * time.Second,
DualStack: true,
}).DialContext,
MaxIdleConns: 100,
IdleConnTimeout: 90 * time.Second,
TLSHandshakeTimeout: 10 * time.Second,
ExpectContinueTimeout: 1 * time.Second,
}
It looks like transport() is returning a RoundTripper by value. Does that
mean that "return DefaultTransport" returns a new copy of DefaultTransport,
or just a copy of a pointer to the global DefaultTransport defined in
transport.go?
Thanks for any tips!
Kyle
--
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.