1
0
mirror of https://github.com/golang/go synced 2024-09-29 05:24:32 -06:00

dog/go1.22: tweak coverage testing notes

Clarify the section in the "go" command notes that deals with the
changes to "go test -cover" for packages without tests, adding a note
that if a package has not tests and no executable code, you still get
a "package has no test files" diagnostic.

Fixes #65262.

Change-Id: Ie960871f9d5c1a1965090738644eace28fc3e156
Reviewed-on: https://go-review.googlesource.com/c/go/+/561337
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Chris Hines <chris.cs.guy@gmail.com>
This commit is contained in:
Than McIntosh 2024-02-05 11:58:35 -05:00
parent 6f44cc88f5
commit 4b0e086348

View File

@ -101,9 +101,10 @@ func main() {
<!-- CL 495447 --> <!-- CL 495447 -->
<p> <p>
<code>go</code> <code>test</code> <code>-cover</code> now prints coverage summaries for covered <code>go</code> <code>test</code> <code>-cover</code> now prints coverage summaries
packages that do not have their own test files. Prior to Go 1.22 a for covered packages that do not have their own test files. Prior to Go 1.22 a
<code>go</code> <code>test</code> <code>-cover</code> run for such a package would report <code>go</code> <code>test</code> <code>-cover</code> run for such a package would
report
</p> </p>
<p> <p>
@ -118,6 +119,13 @@ packages that do not have their own test files. Prior to Go 1.22 a
<code>mymod/mypack coverage: 0.0% of statements</code> <code>mymod/mypack coverage: 0.0% of statements</code>
</p> </p>
<p>
Note that if a package contains no executable code at all, we can't report
a meaningful coverage percentage; for such packages the <code>go</code> tool
will continue to report that there are no test files.
</p>
<h3 id="trace">Trace</h3> <h3 id="trace">Trace</h3>
<!-- https://go.dev/issue/63960 --> <!-- https://go.dev/issue/63960 -->