]> Cypherpunks repositories - gostls13.git/commitdiff
doc/next: document copylock changes
authorTim King <taking@google.com>
Wed, 27 Nov 2024 21:13:07 +0000 (13:13 -0800)
committerGo LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Wed, 27 Nov 2024 22:51:51 +0000 (22:51 +0000)
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>
doc/next/3-tools.md

index 144ac5e67bfc9f7e697db613cba65627b920ca01..33a4e682dca849f50019003772acf3cdaefbb077 100644 (file)
@@ -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 -->