Skip to content

Commit af47554

Browse files
junnplusgaryburd
authored andcommitted
check error before GotConn for trace
Signed-off-by: Ye Sijun <[email protected]>
1 parent bc7ce89 commit af47554

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

client.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -319,14 +319,14 @@ func (d *Dialer) DialContext(ctx context.Context, urlStr string, requestHeader h
319319
}
320320

321321
netConn, err := netDial("tcp", hostPort)
322+
if err != nil {
323+
return nil, nil, err
324+
}
322325
if trace != nil && trace.GotConn != nil {
323326
trace.GotConn(httptrace.GotConnInfo{
324327
Conn: netConn,
325328
})
326329
}
327-
if err != nil {
328-
return nil, nil, err
329-
}
330330

331331
defer func() {
332332
if netConn != nil {

0 commit comments

Comments
 (0)