Skip to content

Commit acc2a74

Browse files
committed
go/analysis/passes/copylock: enable unfortunate tests
CL 628435 moved and disabled these tests. This CL re-enables them for the time when CL 627777 lands. Change-Id: I16cb8d4c23db35fadaac94054183f26bba2449e2 Reviewed-on: https://go-review.googlesource.com/c/tools/+/629235 LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Tim King <[email protected]> Reviewed-by: Alan Donovan <[email protected]>
1 parent 39cb6f0 commit acc2a74

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

go/analysis/passes/copylock/copylock_test.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,7 @@ import (
1616

1717
func Test(t *testing.T) {
1818
testdata := analysistest.TestData()
19-
// TODO(mknyszek): Add "unfortunate" package once CL 627777 lands. That CL changes
20-
// the internals of the sync package structures to carry an explicit noCopy to prevent
21-
// problems from changes to the implementations of those structures, such as these
22-
// tests failing, or a bad user experience.
23-
analysistest.Run(t, testdata, copylock.Analyzer, "a", "typeparams", "issue67787")
19+
analysistest.Run(t, testdata, copylock.Analyzer, "a", "typeparams", "issue67787", "unfortunate")
2420
}
2521

2622
func TestVersions22(t *testing.T) {

go/analysis/passes/copylock/testdata/src/unfortunate/local_go123.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import "sync"
1515
// sync.Mutex gets called out, but without any reference to the sync.Once.
1616
type LocalOnce sync.Once
1717

18-
func (LocalOnce) Bad() {} // want `Bad passes lock by value: a.LocalOnce contains sync.\b.*`
18+
func (LocalOnce) Bad() {} // want `Bad passes lock by value: unfortunate.LocalOnce contains sync.\b.*`
1919

2020
// False negative:
2121
// LocalMutex doesn't have a Lock method.

go/analysis/passes/copylock/testdata/src/unfortunate/local_go124.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import "sync"
1212

1313
type LocalOnce sync.Once
1414

15-
func (LocalOnce) Bad() {} // want "Bad passes lock by value: a.LocalOnce contains sync.noCopy"
15+
func (LocalOnce) Bad() {} // want "Bad passes lock by value: unfortunate.LocalOnce contains sync.noCopy"
1616

1717
type LocalMutex sync.Mutex
1818

19-
func (LocalMutex) Bad() {} // want "Bad passes lock by value: a.LocalMutex contains sync.noCopy"
19+
func (LocalMutex) Bad() {} // want "Bad passes lock by value: unfortunate.LocalMutex contains sync.noCopy"

0 commit comments

Comments
 (0)