doc/go1.20: document changes to the loopclosure vet analysis

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>
This commit is contained in:
Robert Findley 2022-11-15 11:30:55 -05:00
parent 14a41387ac
commit f41fdc1267

View 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>