aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2023-07-03 05:05:55 -0700
committerGopher Robot <gobot@golang.org>2023-07-06 19:37:13 +0000
commit449ef3795d8054faf4a601d8d1aab1f624b822f5 (patch)
tree24a841cfcc5ca1990fb244e73a6e5c43efa620d4
parent6305d7fdd3a5c9d50010c04f4c418444517082ab (diff)
downloadgo-449ef3795d8054faf4a601d8d1aab1f624b822f5.tar.gz
go-449ef3795d8054faf4a601d8d1aab1f624b822f5.zip
net: only build cgo_stub.go on unix or wasip1
We were building it for Windows, although Windows code never calls any of these functions. When using -tags netgo that cause a multiple definition of cgoAvailable. Fixes #61153 Change-Id: Ib9e1de7720a8c0dacd6f12002917bf305dfa5405 Reviewed-on: https://go-review.googlesource.com/c/go/+/507655 Reviewed-by: Damien Neil <dneil@google.com> Auto-Submit: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
-rw-r--r--src/net/cgo_stub.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/net/cgo_stub.go b/src/net/cgo_stub.go
index a8514c19f8..b26b11af8b 100644
--- a/src/net/cgo_stub.go
+++ b/src/net/cgo_stub.go
@@ -3,13 +3,13 @@
// license that can be found in the LICENSE file.
// This file holds stub versions of the cgo functions called on Unix systems.
-// We build this file if using the netgo build tag, or if cgo is not
-// enabled and we are using a Unix system other than Darwin, or if it's
-// wasip1 where cgo is never available.
-// Darwin is exempted because it always provides the cgo routines,
-// in cgo_unix_syscall.go.
+// We build this file:
+// - if using the netgo build tag on a Unix system
+// - on a Unix system without the cgo resolver functions
+// (Darwin always provides the cgo functions, in cgo_unix_syscall.go)
+// - on wasip1, where cgo is never available
-//go:build netgo || (!cgo && unix && !darwin) || wasip1
+//go:build (netgo && unix) || (unix && !cgo && !darwin) || wasip1
package net