1
0
mirror of https://github.com/golang/go synced 2024-11-23 03:40:02 -07:00

net: return fallbackOrder immediately for some GOOS

We don't need to check resolv.conf, nsswitch.conf on these systems.
Seems like this was the behaviour before CL 487196.

Change-Id: I34ef3510891c572772a222fbbe47693aa6c7cf38
GitHub-Last-Rev: 3aace0e661
GitHub-Pull-Request: golang/go#59946
Reviewed-on: https://go-review.googlesource.com/c/go/+/491995
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Mateusz Poliwczak <mpoliwczak34@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
This commit is contained in:
Mateusz Poliwczak 2023-05-11 07:57:33 +00:00 committed by Gopher Robot
parent 41893389a6
commit 1b630b5b00

View File

@ -253,6 +253,12 @@ func (c *conf) lookupOrder(r *Resolver, hostname string) (ret hostLookupOrder, d
canUseCgo = true
}
// On systems that don't use /etc/resolv.conf or /etc/nsswitch.conf, we are done.
switch c.goos {
case "windows", "plan9", "android", "ios":
return fallbackOrder, nil
}
// Try to figure out the order to use for searches.
// If we don't recognize something, use fallbackOrder.
// That will use cgo unless the Go resolver was explicitly requested.