From: Mateusz Poliwczak Date: Thu, 11 May 2023 07:57:33 +0000 (+0000) Subject: net: return fallbackOrder immediately for some GOOS X-Git-Tag: go1.21rc1~571 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=1b630b5b0086d3d272eb1d613d7b817a85fbd7f9;p=gostls13.git 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: 3aace0e6615b79bbf379e05ca3a353e194dc7c0b GitHub-Pull-Request: golang/go#59946 Reviewed-on: https://go-review.googlesource.com/c/go/+/491995 TryBot-Result: Gopher Robot Reviewed-by: Cherry Mui Run-TryBot: Mateusz Poliwczak Run-TryBot: Ian Lance Taylor Auto-Submit: Ian Lance Taylor Reviewed-by: Ian Lance Taylor --- diff --git a/src/net/conf.go b/src/net/conf.go index 10bc8c366e..cec996f7f0 100644 --- a/src/net/conf.go +++ b/src/net/conf.go @@ -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.