func (*http2Transport) RoundTrip(*Request) (*Response, error) { panic(noHTTP2) }
 func (*http2Transport) CloseIdleConnections()                 {}
 
-type http2erringRoundTripper struct{ err error }
-
-func (http2erringRoundTripper) RoundTrip(*Request) (*Response, error) { panic(noHTTP2) }
-
 type http2noDialH2RoundTripper struct{}
 
 func (http2noDialH2RoundTripper) RoundTrip(*Request) (*Response, error) { panic(noHTTP2) }
 
        return nil
 }
 
+type erringRoundTripper interface {
+       RoundTripErr() error
+}
+
 func (t *Transport) dialConn(ctx context.Context, cm connectMethod) (pconn *persistConn, err error) {
        pconn = &persistConn{
                t:             t,
        if s := pconn.tlsState; s != nil && s.NegotiatedProtocolIsMutual && s.NegotiatedProtocol != "" {
                if next, ok := t.TLSNextProto[s.NegotiatedProtocol]; ok {
                        alt := next(cm.targetAddr, pconn.conn.(*tls.Conn))
-                       if e, ok := alt.(http2erringRoundTripper); ok {
+                       if e, ok := alt.(erringRoundTripper); ok {
                                // pconn.conn was closed by next (http2configureTransport.upgradeFn).
-                               return nil, e.err
+                               return nil, e.RoundTripErr()
                        }
                        return &persistConn{t: t, cacheKey: pconn.cacheKey, alt: alt}, nil
                }