Skip to content

Commit 4b0e086

Browse files
committed
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 <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Chris Hines <[email protected]>
1 parent 6f44cc8 commit 4b0e086

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

doc/go1.22.html

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,10 @@ <h3 id="go-command">Go command</h3>
101101

102102
<!-- CL 495447 -->
103103
<p>
104-
<code>go</code> <code>test</code> <code>-cover</code> now prints coverage summaries for covered
105-
packages that do not have their own test files. Prior to Go 1.22 a
106-
<code>go</code> <code>test</code> <code>-cover</code> run for such a package would report
104+
<code>go</code> <code>test</code> <code>-cover</code> now prints coverage summaries
105+
for covered packages that do not have their own test files. Prior to Go 1.22 a
106+
<code>go</code> <code>test</code> <code>-cover</code> run for such a package would
107+
report
107108
</p>
108109

109110
<p>
@@ -118,6 +119,13 @@ <h3 id="go-command">Go command</h3>
118119
<code>mymod/mypack coverage: 0.0% of statements</code>
119120
</p>
120121

122+
<p>
123+
Note that if a package contains no executable code at all, we can't report
124+
a meaningful coverage percentage; for such packages the <code>go</code> tool
125+
will continue to report that there are no test files.
126+
</p>
127+
128+
121129
<h3 id="trace">Trace</h3>
122130

123131
<!-- https://go.dev/issue/63960 -->

0 commit comments

Comments
 (0)