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 <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Tim King <taking@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
This commit is contained in:
Michael Anthony Knyszek 2024-11-18 17:35:34 +00:00 коммит произвёл Michael Knyszek
Родитель 39cb6f0e85
Коммит acc2a7418d
3 изменённых файлов: 4 добавлений и 8 удалений

Просмотреть файл

@ -16,11 +16,7 @@ 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")
analysistest.Run(t, testdata, copylock.Analyzer, "a", "typeparams", "issue67787", "unfortunate")
}
func TestVersions22(t *testing.T) {

Просмотреть файл

@ -15,7 +15,7 @@ import "sync"
// sync.Mutex gets called out, but without any reference to the sync.Once.
type LocalOnce sync.Once
func (LocalOnce) Bad() {} // want `Bad passes lock by value: a.LocalOnce contains sync.\b.*`
func (LocalOnce) Bad() {} // want `Bad passes lock by value: unfortunate.LocalOnce contains sync.\b.*`
// False negative:
// LocalMutex doesn't have a Lock method.

Просмотреть файл

@ -12,8 +12,8 @@ import "sync"
type LocalOnce sync.Once
func (LocalOnce) Bad() {} // want "Bad passes lock by value: a.LocalOnce contains sync.noCopy"
func (LocalOnce) Bad() {} // want "Bad passes lock by value: unfortunate.LocalOnce contains sync.noCopy"
type LocalMutex sync.Mutex
func (LocalMutex) Bad() {} // want "Bad passes lock by value: a.LocalMutex contains sync.noCopy"
func (LocalMutex) Bad() {} // want "Bad passes lock by value: unfortunate.LocalMutex contains sync.noCopy"