From: Michael Anthony Knyszek Date: Fri, 15 Nov 2024 19:42:57 +0000 Subject: go/analysis/passes/copylock: test for noCopy for sync Map, Mutex, Once Right now the copylock tests check for details on these types that are implementation details and/or have some other problem (a less useful error message, or a false negative altogether). CL 627777 modifies the sync package to attach explicit anonymous noCopy fields on each of these types. This change updates the tests to match that, which also helps with and/or resolves a couple issues with copylock captured in the test suite. Note: this change also temporarily disables a couple of the problematic tests. In the next CL we'll re-enable them, once CL 627777 lands. Change-Id: I100c71ea05b4f08595e37d0c8e81f9543abe7d74 Reviewed-on: https://go-review.googlesource.com/c/tools/+/628435 LUCI-TryBot-Result: Go LUCI Reviewed-by: Alan Donovan Reviewed-by: Tim King Forwarded: not-needed Origin: upstream --- go/analysis/passes/copylock/copylock_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/go/analysis/passes/copylock/copylock_test.go b/go/analysis/passes/copylock/copylock_test.go index dcde44a..a58c934 100644 --- a/go/analysis/passes/copylock/copylock_test.go +++ b/go/analysis/passes/copylock/copylock_test.go @@ -15,6 +15,10 @@ import ( func Test(t *testing.T) { testdata := analysistest.TestData() + // TODO(mknyszek): Add "unfortunate" package once CL 627777 lands. That CL changes + // the internals of the sync package structures to carry an explicit noCopy to prevent + // problems from changes to the implementations of those structures, such as these + // tests failing, or a bad user experience. analysistest.Run(t, testdata, copylock.Analyzer, "a", "typeparams", "issue67787", "unfortunate") }