1
0
mirror of https://github.com/golang/go synced 2024-11-17 05:04:54 -07:00

net: clean up redundant if branch in dial

Dialer.DialContext no longer performs a redundant check on the length
of the fallback slice, because dialParallel already handles the
situation where the fallback slice is empty or nil.

Change-Id: Ibb16f4813fc55dec2939c54c10e665ff35bfe163
Reviewed-on: https://go-review.googlesource.com/c/go/+/387795
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
This commit is contained in:
Shang Ding 2022-02-23 19:35:21 -06:00 committed by Tobias Klauser
parent 2b8178c14d
commit ebe624dd30

View File

@ -421,12 +421,7 @@ func (d *Dialer) DialContext(ctx context.Context, network, address string) (Conn
primaries = addrs
}
var c Conn
if len(fallbacks) > 0 {
c, err = sd.dialParallel(ctx, primaries, fallbacks)
} else {
c, err = sd.dialSerial(ctx, primaries)
}
c, err := sd.dialParallel(ctx, primaries, fallbacks)
if err != nil {
return nil, err
}