]> Cypherpunks repositories - gostls13.git/commitdiff
net: don't set netGo = true on Windows with no cgo
authorIan Lance Taylor <iant@golang.org>
Tue, 21 Jun 2022 22:17:22 +0000 (15:17 -0700)
committerGopher Robot <gobot@golang.org>
Wed, 22 Jun 2022 16:18:44 +0000 (16:18 +0000)
Windows can call the C DNS lookup routines even without cgo,
so don't force it to use the Go routines in that scenario.

No test because the test requires building the tools with CGO_ENABLED=0.

For #33097
Fixes #53490

Change-Id: I3595a68e788be0d3bbd1bbd431836aca20a7d757
Reviewed-on: https://go-review.googlesource.com/c/go/+/413458
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>

src/net/cgo_stub.go
src/net/netgo.go

index cc84ca47aed0bc79b7791909474c7beab6e1d2fe..298d829f6fa6db090bb2ef20b055417c75bfe03e 100644 (file)
@@ -8,8 +8,6 @@ package net
 
 import "context"
 
-func init() { netGo = true }
-
 type addrinfoErrno int
 
 func (eai addrinfoErrno) Error() string   { return "<nil>" }
index f91c91b6148581417563b6058113fffcdcdc8786..75baa880354c5c3b64c4d68a0582c254a3e919ba 100644 (file)
@@ -2,7 +2,11 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build netgo
+// Default netGo to true if the netgo build tag is being used, or the
+// C library DNS routines are not available. Note that the C library
+// routines are always available on Windows.
+
+//go:build netgo || (!cgo && !windows)
 
 package net