I know I can write code like this, but I don't know how it works:
type MyTransport struct {
http.Transport
}
func (myT *MyTransport) RoundTrip(r *http.Request) (*http.Response, error) {
return myT.Transport.RoundTrip(r)
}
http.Transport
is just a struct, right? It has no name. So how does myT.Transport
work? Why do I not have to give the transport a name in MyTransport
, such as declaring it like ht http.Transport
?