mirror of https://github.com/golang/go.git
doc/next: document copylock changes
Fixes #66387 Change-Id: Ida9381d1ea83bcceaba460014fac3d0c13ccdbff Reviewed-on: https://go-review.googlesource.com/c/go/+/632315 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Commit-Queue: Tim King <taking@google.com> Reviewed-by: Alan Donovan <adonovan@google.com>
This commit is contained in:
parent
2a93bd0d79
commit
b7e450bf27
|
|
@ -49,6 +49,15 @@ with no other arguments. Such calls are nearly always a mistake
|
|||
as the value of `s` may contain the `%` symbol; use `fmt.Print` instead.
|
||||
See [#60529](/issue/60529).
|
||||
|
||||
<!-- go.dev/issue/66387 -->
|
||||
The existing `copylock` analyzer now reports a diagnostic when a
|
||||
variable declared in a 3-clause "for" loop such as
|
||||
`for i := iter(); done(i); i = next(i) { ... }` contains a `sync.Locker`,
|
||||
such as a `sync.Mutex`. [Go 1.22](/doc/go1.22#language) changed the behavior
|
||||
of these loops to create a new variable for each iteration, copying the
|
||||
value from the previous iteration; this copy operation is not safe for locks.
|
||||
See [#66387](/issue/66387).
|
||||
|
||||
### GOCACHEPROG
|
||||
|
||||
<!-- go.dev/issue/64876 -->
|
||||
|
|
|
|||
Loading…
Reference in New Issue