]> Cypherpunks repositories - gostls13.git/commitdiff
dog/go1.22: tweak coverage testing notes
authorThan McIntosh <thanm@google.com>
Mon, 5 Feb 2024 16:58:35 +0000 (11:58 -0500)
committerThan McIntosh <thanm@google.com>
Tue, 6 Feb 2024 15:59:53 +0000 (15:59 +0000)
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>
doc/go1.22.html

index 39e2dca61052c5dbf46ad900e6c08b24e897536b..f9750a319188ddee9b24e32c0fe1b640781678a9 100644 (file)
@@ -101,9 +101,10 @@ func main() {
 
 <!-- CL 495447 -->
 <p>
-<code>go</code> <code>test</code> <code>-cover</code> now prints coverage summaries 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> now prints coverage summaries
+  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
 </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>
 </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>
 
 <!-- https://go.dev/issue/63960 -->