aboutsummaryrefslogtreecommitdiff
path: root/src/net/lookup.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2015-08-25 11:25:46 -0400
committerRuss Cox <rsc@golang.org>2015-08-27 16:17:21 +0000
commit35365b97f120e112c2967ec617b897bdd919fab2 (patch)
treeaca1cf31e2a1c3ab854e1094b82f8e84639fccaa /src/net/lookup.go
parent8261c887aaf997655b95591c17b1068bb627dc9d (diff)
downloadgo-35365b97f120e112c2967ec617b897bdd919fab2.tar.gz
go-35365b97f120e112c2967ec617b897bdd919fab2.zip
net: restore LookupPort for integer strings
This worked in Go 1.4 but was lost in the "pure Go" lookup routines substituted late in the Go 1.5 cycle. Fixes #12263. Change-Id: I77ec9d97cd8e67ace99d6ac965e5bc16c151ba83 Reviewed-on: https://go-review.googlesource.com/13915 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/net/lookup.go')
-rw-r--r--src/net/lookup.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/net/lookup.go b/src/net/lookup.go
index a7ceee823f..9008322dc5 100644
--- a/src/net/lookup.go
+++ b/src/net/lookup.go
@@ -123,6 +123,9 @@ func lookupIPDeadline(host string, deadline time.Time) (addrs []IPAddr, err erro
// LookupPort looks up the port for the given network and service.
func LookupPort(network, service string) (port int, err error) {
+ if n, i, ok := dtoi(service, 0); ok && i == len(service) {
+ return n, nil
+ }
return lookupPort(network, service)
}