I'd like to be able to copy the http.DefaultTransport then tweak it for
my app.
http.DefaultTransport has a lot of good defaults in, so copying it then
tweaking it makes it forward compatible with changes (a good example of
a recent change would be the ExpectContinueTimeout).
You might think you could just do
newTransport := new(http.Transport)
*newTransport = *http.DefaultTransport
new.Transport.MaxIdleConns = myTweakedValue
But if you do that then go vet moans about copying mutexes (for very
good reasons).
The best I could come up with was using a bit of reflection
https://play.golang.org/p/l2mkCTZSzL
Is there a better way?
Should making an http.Transport with the default settings in be
something the standard library should support? Maybe a
NewDefaultTransport() function?
--
Nick Craig-Wood <
ni...@craig-wood.com> --
http://www.craig-wood.com/nick