]> Cypherpunks repositories - gostls13.git/commitdiff
doc/go1.20: document changes to the loopclosure vet analysis
authorRobert Findley <rfindley@google.com>
Tue, 15 Nov 2022 16:30:55 +0000 (11:30 -0500)
committerRobert Findley <rfindley@google.com>
Tue, 22 Nov 2022 02:52:19 +0000 (02:52 +0000)
Address the release notes TODO regarding the loopclosure analyzer,
documenting the new warning for parallel subtests.

In doing so, choose a structure for the vet section, opting for h4
headings. In recent years, we have used either h4 headings or simple
paragraphs to document vet changes. This year, I thought it worthwhile
to put the timeformat and loopclosure changes into separate sections.

Also document the improvements to reference capture detection introduced
in CL 452615.

Change-Id: I05886f7025d66bb7f2609f787f69d1a769ca6f5e
Reviewed-on: https://go-review.googlesource.com/c/go/+/450735
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Tim King <taking@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

doc/go1.20.html

index aaa811e59581aed9e587bab9e8b596043a5df9b8..4ffb5a457fe665ee9f32421deab3996617084b41 100644 (file)
@@ -182,12 +182,26 @@ Do not send CLs removing the interior tags from such phrases.
 
 <h3 id="vet">Vet</h3>
 
+<h4 id="vet-timeformat">New diagnostic for incorrect time formats</h4>
+
 <p><!-- https://go.dev/issue/48801, CL 354010 -->
   TODO: <a href="https://go.dev/issue/48801">https://go.dev/issue/48801</a>: check for time formats with 2006-02-01
 </p>
 
+<h4 id="vet-loopclosure">Improved detection of loop variable capture by nested functions</h4>
+
 <p><!-- CL 447256 --><!-- https://go.dev/issue/55972: extend the loopclosure analysis to parallel subtests -->
-  TODO: https://go.dev/issue/55972: extend the loopclosure analysis to parallel subtests
+  The <code>vet</code> tool now reports references to loop variables following
+  a call to <a href="/pkg/testing/#T.Parallel"><code>T.Parallel()</code></a>
+  within subtest function bodies. Such references may observe the value of the
+  variable from a different iteration (typically causing test cases to be
+  skipped) or an invalid state due to unsynchronized concurrent access.
+</p>
+
+<p><!-- CL 452615 -->
+  The tool also detects reference mistakes in more places. Previously it would
+  only consider the last statement of the loop body, but now it recursively
+  inspects the last statements within if, switch, and select statements.
 </p>
 
 <h2 id="runtime">Runtime</h2>