Skip to content

Commit

Permalink
net: don't set netGo = true on Windows with no cgo
Browse files Browse the repository at this point in the history
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 golang#33097
Fixes golang#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>
  • Loading branch information
ianlancetaylor authored and jproberts committed Aug 10, 2022
1 parent b11beb2 commit afb29d5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 0 additions & 2 deletions src/net/cgo_stub.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ package net

import "context"

func init() { netGo = true }

type addrinfoErrno int

func (eai addrinfoErrno) Error() string { return "<nil>" }
Expand Down
6 changes: 5 additions & 1 deletion src/net/netgo.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit afb29d5

Please sign in to comment.