]> Cypherpunks repositories - gostls13.git/commit
sync: add explicit noCopy fields to Map, Mutex, and Once
authorMichael Anthony Knyszek <mknyszek@google.com>
Fri, 15 Nov 2024 19:22:16 +0000 (19:22 +0000)
committerGopher Robot <gobot@golang.org>
Mon, 18 Nov 2024 18:52:54 +0000 (18:52 +0000)
commit53b2b64b649b26c7bb3397bec5d86d3b203eb015
treebeb5bfed693fe9226fb5fbe8b5525788654f1cb9
parent5a0f2a7a7c5658f4f3065c265cee61ec1bde9691
sync: add explicit noCopy fields to Map, Mutex, and Once

Following CLs will refactor Mutex and change the internals of Map. This
ends up breaking tests in x/tools for the copylock vet check, because
the error message changes. Let's insulate ourselves from such things
permanently by adding an explicit noCopy field. We'll update the vet
check to accept that as the problem, rather than depend on less explicit
internals.

We capture Once here too to clean up the error message as well.

Change-Id: Iead985fc8ec9ef3ea5ff615f26dde17bb03aeadb
Reviewed-on: https://go-review.googlesource.com/c/go/+/627777
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Tim King <taking@google.com>
src/sync/map.go
src/sync/mutex.go
src/sync/once.go
test/assign.go