-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/go: go test -race
does not set implicit race
build tag
#54468
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This is WAI, as your code shows
You are using build constraints https://pkg.go.dev/go/build#hdr-Build_Constraints In the meantime |
Won't go add build tag "race" when race enabled? |
Go1.17 isn't works fine, it's a bug.
If you insist this is a bug, I can reopen it. |
I think there is a bug here. We may be enabling the "race" build constraint for some purposes but not others. Changing |
I think this is a bug. And I find that if we build with the single file instead of "./...", it will pass:
|
The implicit |
@578559967, can you identify a Go version at which the test worked as expected (perhaps using |
go1.17.5、go1.17.10、go1.17.13 all worked as expected. |
Change https://go.dev/cl/425154 mentions this issue: |
diff --git a/src/cmd/go/internal/work/init.go b/src/cmd/go/internal/work/init.go
index dc368de1c1..26192ecaed 100644
--- a/src/cmd/go/internal/work/init.go
+++ b/src/cmd/go/internal/work/init.go
@@ -138,7 +138,7 @@ func instrumentInit() {
cfg.BuildContext.InstallSuffix += "_"
}
cfg.BuildContext.InstallSuffix += mode
- cfg.BuildContext.BuildTags = append(cfg.BuildContext.BuildTags, mode)
+ cfg.BuildContext.ToolTags = append(cfg.BuildContext.ToolTags, mode)
}
|
@gopherbot, please backport to Go 1.19 and 1.18. This is a regression from prior releases that can cause build failures. |
Backport issue(s) opened: #54659 (for 1.18), #54660 (for 1.19). Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://go.dev/wiki/MinorReleases. |
race
build tag
race
build taggo test -race
does not set implicit race
build tag
Change https://go.dev/cl/426434 mentions this issue: |
Change https://go.dev/cl/426435 mentions this issue: |
…the Tags map This fixes a regression introduced when the "race" mode tag was moved to the ToolTags field in CL 358539. Fixes #54659 Updates #54468 Change-Id: I107771948a4fe9d743cc13d1c15f324212b08e03 GitHub-Last-Rev: d211e35 GitHub-Pull-Request: #54618 Reviewed-on: https://go-review.googlesource.com/c/go/+/425154 Reviewed-by: David Chase <drchase@google.com> Auto-Submit: Bryan Mills <bcmills@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> (cherry picked from commit 6ba2674) Reviewed-on: https://go-review.googlesource.com/c/go/+/426435 Reviewed-by: Heschi Kreinick <heschi@google.com>
…the Tags map This fixes a regression introduced when the "race" mode tag was moved to the ToolTags field in CL 358539. Fixes #54660 Updates #54468 Change-Id: I107771948a4fe9d743cc13d1c15f324212b08e03 GitHub-Last-Rev: d211e35 GitHub-Pull-Request: #54618 Reviewed-on: https://go-review.googlesource.com/c/go/+/425154 Reviewed-by: David Chase <drchase@google.com> Auto-Submit: Bryan Mills <bcmills@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> (cherry picked from commit 6ba2674) Reviewed-on: https://go-review.googlesource.com/c/go/+/426434 Reviewed-by: Heschi Kreinick <heschi@google.com>
…the Tags map This fixes a regression introduced when the "race" mode tag was moved to the ToolTags field in CL 358539. Fixes golang#54660 Updates golang#54468 Change-Id: I107771948a4fe9d743cc13d1c15f324212b08e03 GitHub-Last-Rev: d211e35 GitHub-Pull-Request: golang#54618 Reviewed-on: https://go-review.googlesource.com/c/go/+/425154 Reviewed-by: David Chase <drchase@google.com> Auto-Submit: Bryan Mills <bcmills@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> (cherry picked from commit 6ba2674) Reviewed-on: https://go-review.googlesource.com/c/go/+/426434 Reviewed-by: Heschi Kreinick <heschi@google.com>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
run_test.go:
go.mod:
go.sum:
compile and run the test:
What did you expect to see?
expect to see:
What did you see instead?
but the go1.17.10 can compile successfully and output the expected result.
The text was updated successfully, but these errors were encountered: