aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMateusz Poliwczak <mpoliwczak34@gmail.com>2024-09-27 19:57:12 +0000
committerGopher Robot <gobot@golang.org>2024-09-30 12:39:31 +0000
commit6536c207c2309da7c1c21e3669f8ddf491e31f5b (patch)
tree6857745018ea6c0da5de0030a8604fcddb070da9 /src
parent0fb33863b78c03f4f3d6228e310869f2edff1195 (diff)
downloadgo-6536c207c2309da7c1c21e3669f8ddf491e31f5b.tar.xz
net: improve GODEBUG=netdns=1 debug messages
Fixes #69680 Change-Id: I73b0506c7a3245ba282cffabe47543f5fce86692 GitHub-Last-Rev: 4c6a1a4c706f39d2756c65b72b78896cd4881302 GitHub-Pull-Request: golang/go#69684 Reviewed-on: https://go-review.googlesource.com/c/go/+/616263 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/net/conf.go29
1 files changed, 20 insertions, 9 deletions
diff --git a/src/net/conf.go b/src/net/conf.go
index 1b48546f1b..92c5618d1e 100644
--- a/src/net/conf.go
+++ b/src/net/conf.go
@@ -93,19 +93,30 @@ func initConfVal() {
if confVal.dnsDebugLevel > 1 {
println("go package net: confVal.netCgo =", confVal.netCgo, " netGo =", confVal.netGo)
}
+ if dnsMode != "go" && dnsMode != "cgo" && dnsMode != "" {
+ println("go package net: GODEBUG=netdns contains an invalid dns mode, ignoring it")
+ }
switch {
- case confVal.netGo:
- if netGoBuildTag {
- println("go package net: built with netgo build tag; using Go's DNS resolver")
+ case netGoBuildTag || !cgoAvailable:
+ if dnsMode == "cgo" {
+ println("go package net: ignoring GODEBUG=netdns=cgo as the binary was compiled without support for the cgo resolver")
+ } else {
+ println("go package net: using the Go DNS resolver")
+ }
+ case netCgoBuildTag:
+ if dnsMode == "go" {
+ println("go package net: GODEBUG setting forcing use of the Go resolver")
} else {
- println("go package net: GODEBUG setting forcing use of Go's resolver")
+ println("go package net: using the cgo DNS resolver")
}
- case !cgoAvailable:
- println("go package net: cgo resolver not supported; using Go's DNS resolver")
- case confVal.netCgo || confVal.preferCgo:
- println("go package net: using cgo DNS resolver")
default:
- println("go package net: dynamic selection of DNS resolver")
+ if dnsMode == "go" {
+ println("go package net: GODEBUG setting forcing use of the Go resolver")
+ } else if dnsMode == "cgo" {
+ println("go package net: GODEBUG setting forcing use of the cgo resolver")
+ } else {
+ println("go package net: dynamic selection of DNS resolver")
+ }
}
}()
}