diff options
| author | apocelipes <seve3r@outlook.com> | 2023-09-14 18:43:14 +0000 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2023-09-15 12:57:52 +0000 |
| commit | 1fde99cd6eff725f5cc13748a43b4aef3de557c8 (patch) | |
| tree | c85262d3c82346b40ffa3d1dc69887d8f20be22d /src/net/dial.go | |
| parent | 00073c25f65947dc4a331dcc6b20cb215fb03341 (diff) | |
| download | go-1fde99cd6eff725f5cc13748a43b4aef3de557c8.tar.xz | |
net: use bytealg.LastIndexByteString
There is no need to handwrite the "last" function, the bytealg package already provides "LastIndexByteString".
Change-Id: I6000705bffe8450a10cf8f3fa716a8d4605ada1f
GitHub-Last-Rev: 6627c65fb40fad96239edd28bde27a30f9f8f544
GitHub-Pull-Request: golang/go#62647
Reviewed-on: https://go-review.googlesource.com/c/go/+/527976
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Diffstat (limited to 'src/net/dial.go')
| -rw-r--r-- | src/net/dial.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/net/dial.go b/src/net/dial.go index dd34b6cef2..7ca9b4a468 100644 --- a/src/net/dial.go +++ b/src/net/dial.go @@ -6,6 +6,7 @@ package net import ( "context" + "internal/bytealg" "internal/godebug" "internal/nettrace" "syscall" @@ -226,7 +227,7 @@ func (d *Dialer) fallbackDelay() time.Duration { } func parseNetwork(ctx context.Context, network string, needsProto bool) (afnet string, proto int, err error) { - i := last(network, ':') + i := bytealg.LastIndexByteString(network, ':') if i < 0 { // no colon switch network { case "tcp", "tcp4", "tcp6": |
