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