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