aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCherry Mui <cherryyz@google.com>2022-12-20 17:19:09 -0500
committerCherry Mui <cherryyz@google.com>2022-12-22 04:34:09 +0000
commit18baca6765f75c0973b9d90cb6123f1eb339ad4c (patch)
tree43ea52d32d1701ab684276167bad9e23fa8fd238
parent13ed4f42f03cac6d9ad701a3041dba06c84dc70d (diff)
downloadgo-18baca6765f75c0973b9d90cb6123f1eb339ad4c.tar.gz
go-18baca6765f75c0973b9d90cb6123f1eb339ad4c.zip
runtime/race: add build tag to internal amd64vN packages
Only one of the runtime/race/internal/amd64vN packages should be included in a build. Generally this is true because the runtime/race package would import only one of them depending on the build configuration. But for "go install -buildmode=shared std" it includes all Go packages in std, which includes both, which then causes link-time failure due to duplicated symbols. To avoid this, we add build tags to the internal packages, so, depending on the build configuation, only one package would contain buildable go files therefore be included in the build. For #57334. Change-Id: I52ddc3a40e16c7d04b4dd861e9689918d27e8509 Reviewed-on: https://go-review.googlesource.com/c/go/+/458695 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Cherry Mui <cherryyz@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
-rw-r--r--src/runtime/race/internal/amd64v1/doc.go2
-rw-r--r--src/runtime/race/internal/amd64v3/doc.go2
-rw-r--r--src/runtime/race/race_v1_amd64.go1
-rw-r--r--src/runtime/race/race_v3_amd64.go1
4 files changed, 4 insertions, 2 deletions
diff --git a/src/runtime/race/internal/amd64v1/doc.go b/src/runtime/race/internal/amd64v1/doc.go
index 130b290bdb..ccb088cc46 100644
--- a/src/runtime/race/internal/amd64v1/doc.go
+++ b/src/runtime/race/internal/amd64v1/doc.go
@@ -5,4 +5,6 @@
// This package holds the race detector .syso for
// amd64 architectures with GOAMD64<v3.
+//go:build amd64 && ((linux && !amd64.v3) || darwin || freebsd || netbsd || openbsd || windows)
+
package amd64v1
diff --git a/src/runtime/race/internal/amd64v3/doc.go b/src/runtime/race/internal/amd64v3/doc.go
index 6983335281..215998a90c 100644
--- a/src/runtime/race/internal/amd64v3/doc.go
+++ b/src/runtime/race/internal/amd64v3/doc.go
@@ -5,4 +5,6 @@
// This package holds the race detector .syso for
// amd64 architectures with GOAMD64>=v3.
+//go:build amd64 && linux && amd64.v3
+
package amd64v3
diff --git a/src/runtime/race/race_v1_amd64.go b/src/runtime/race/race_v1_amd64.go
index b8a20315fd..7c40db1dcf 100644
--- a/src/runtime/race/race_v1_amd64.go
+++ b/src/runtime/race/race_v1_amd64.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build (linux && !amd64.v3) || darwin || freebsd || netbsd || openbsd || windows
-// +build linux,!amd64.v3 darwin freebsd netbsd openbsd windows
package race
diff --git a/src/runtime/race/race_v3_amd64.go b/src/runtime/race/race_v3_amd64.go
index 913bb77f48..80728d834a 100644
--- a/src/runtime/race/race_v3_amd64.go
+++ b/src/runtime/race/race_v3_amd64.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build linux && amd64.v3
-// +build linux,amd64.v3
package race