File tree 1 file changed +20
-9
lines changed 1 file changed +20
-9
lines changed Original file line number Diff line number Diff line change @@ -94,19 +94,30 @@ func initConfVal() {
94
94
if confVal .dnsDebugLevel > 1 {
95
95
println ("go package net: confVal.netCgo =" , confVal .netCgo , " netGo =" , confVal .netGo )
96
96
}
97
+ if dnsMode != "go" && dnsMode != "cgo" && dnsMode != "" {
98
+ println ("go package net: GODEBUG=netdns contains an invalid dns mode, ignoring it" )
99
+ }
97
100
switch {
98
- case confVal .netGo :
99
- if netGoBuildTag {
100
- println ("go package net: built with netgo build tag; using Go's DNS resolver" )
101
+ case netGoBuildTag || ! cgoAvailable :
102
+ if dnsMode == "cgo" {
103
+ println ("go package net: ignoring GODEBUG=netdns=cgo as the binary was compiled without support for the cgo resolver" )
104
+ } else {
105
+ println ("go package net: using the Go DNS resolver" )
106
+ }
107
+ case netCgoBuildTag :
108
+ if dnsMode == "go" {
109
+ println ("go package net: GODEBUG setting forcing use of the Go resolver" )
101
110
} else {
102
- println ("go package net: GODEBUG setting forcing use of Go's resolver" )
111
+ println ("go package net: using the cgo DNS resolver" )
103
112
}
104
- case ! cgoAvailable :
105
- println ("go package net: cgo resolver not supported; using Go's DNS resolver" )
106
- case confVal .netCgo || confVal .preferCgo :
107
- println ("go package net: using cgo DNS resolver" )
108
113
default :
109
- println ("go package net: dynamic selection of DNS resolver" )
114
+ if dnsMode == "go" {
115
+ println ("go package net: GODEBUG setting forcing use of the Go resolver" )
116
+ } else if dnsMode == "cgo" {
117
+ println ("go package net: GODEBUG setting forcing use of the cgo resolver" )
118
+ } else {
119
+ println ("go package net: dynamic selection of DNS resolver" )
120
+ }
110
121
}
111
122
}()
112
123
}
You can’t perform that action at this time.
0 commit comments