From 4b0e086348c99eaa458f18e4b3e4498f0aaadc1a Mon Sep 17 00:00:00 2001 From: Than McIntosh Date: Mon, 5 Feb 2024 11:58:35 -0500 Subject: [PATCH] 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 Reviewed-by: Dmitri Shuralyov LUCI-TryBot-Result: Go LUCI Reviewed-by: Chris Hines --- doc/go1.22.html | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/doc/go1.22.html b/doc/go1.22.html index 39e2dca61052c..f9750a319188d 100644 --- a/doc/go1.22.html +++ b/doc/go1.22.html @@ -101,9 +101,10 @@

Go command

-go test -cover now prints coverage summaries for covered -packages that do not have their own test files. Prior to Go 1.22 a -go test -cover run for such a package would report + go test -cover now prints coverage summaries + for covered packages that do not have their own test files. Prior to Go 1.22 a + go test -cover run for such a package would + report

@@ -118,6 +119,13 @@

Go command

mymod/mypack coverage: 0.0% of statements

+

+ Note that if a package contains no executable code at all, we can't report + a meaningful coverage percentage; for such packages the go tool + will continue to report that there are no test files. +

+ +

Trace