Skip to content

Commit 92c9b81

Browse files
ianlancetaylorgopherbot
authored andcommitted
net: don't set netGo = true on Windows with no cgo
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>
1 parent be0b2a3 commit 92c9b81

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/net/cgo_stub.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ package net
88

99
import "context"
1010

11-
func init() { netGo = true }
12-
1311
type addrinfoErrno int
1412

1513
func (eai addrinfoErrno) Error() string { return "<nil>" }

src/net/netgo.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
//go:build netgo
5+
// Default netGo to true if the netgo build tag is being used, or the
6+
// C library DNS routines are not available. Note that the C library
7+
// routines are always available on Windows.
8+
9+
//go:build netgo || (!cgo && !windows)
610

711
package net
812

0 commit comments

Comments
 (0)