1
0
mirror of https://github.com/golang/go synced 2024-11-22 19:54:39 -07:00

doc/go1.20: add section on coverage

Add some basic material on the changes to code coverage testing
to the release notes.

For #54202.

Change-Id: I28200d43b4952ce8e8ecf46c8fe8e97c81d245e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/453857
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Eli Bendersky <eliben@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
This commit is contained in:
Than McIntosh 2022-11-30 12:04:59 -05:00
parent 7ed50cfd09
commit f715d28cea

View File

@ -175,6 +175,14 @@ Do not send CLs removing the interior tags from such phrases.
Specifying <code>-pgo=off</code> turns off profile-guided optimization.
</p>
<p><!-- https://go.dev/issue/51430 -->
The <code>go</code> <code>build</code>, <code>go</code> <code>install</code>,
and other build-related commands now support a <code>-cover</code>
flag that builds the specified target with code coverage instrumentation.
This is described in more detail in the
<a href="#cover">Cover</a> section below.
</p>
<h4 id="go-version"><code>go</code> <code>version</code></h4>
<p><!-- https://go.dev/issue/48187 -->
@ -228,7 +236,19 @@ Do not send CLs removing the interior tags from such phrases.
<h3 id="cover">Cover</h3>
<p><!-- CL 436236, CL 401236, CL 438503 -->
TODO coverage
Go 1.20 supports collecting code coverage profiles for programs
(applications and integration tests), as opposed to just unit tests.
</p>
<p>
To collect coverage data for a program, build it with <code>go</code>
<code>build</code>'s <code>-cover</code> flag, then run the resulting
binary with the environment variable <code>GOCOVERDIR</code> set
to an output directory for coverage profiles.
See the
<a href="https://go.dev/testing/coverage">'coverage for integration tests' landing page</a> for more on how to get started.
For details on the design and implementation, see the
<a href="https://golang.org/issue/51430">proposal</a>.
</p>
<h3 id="vet">Vet</h3>
@ -285,6 +305,13 @@ Do not send CLs removing the interior tags from such phrases.
assists in some circumstances.
</p>
<p><!-- https://go.dev/issue/51430 -->
Go 1.20 adds a new <code>runtime/coverage</code> package
containing APIs for writing coverage profile data at
runtime from a long-running and/or server programs that
do not terminate via <code>os.Exit()</code>.
</p>
<h2 id="compiler">Compiler</h2>
<p><!-- https://go.dev/issue/55022 -->