diff --git a/src/net/http/transport.go b/src/net/http/transport.go index 70797ddfe7e7ea..e4854e8a146402 100644 --- a/src/net/http/transport.go +++ b/src/net/http/transport.go @@ -523,6 +523,11 @@ func (t *Transport) getConn(req *Request, cm connectMethod) (*persistConn, error } dialc := make(chan dialRes) + // Copy these hooks so we don't race on the postPendingDial in + // the goroutine we launch. Issue 11136. + prePendingDial := prePendingDial + postPendingDial := postPendingDial + handlePendingDial := func() { if prePendingDial != nil { prePendingDial()