Skip to content

Commit bbf6766

Browse files
committed
cmd/go: clarify that -coverpkg uses import paths
This change amends the long-form help output for 'go help build' and 'go help testflag' to specify that the '-coverpkg' flag operates explicitly on import paths as well as package names. Import paths are fundamental for precise specification of packages versus unqualified package names, and the naming of the flag '-coverpkg' and its original documentation leads a user to assume that it only operates on the simple, unqualified package name form. The situation warrants clarification. Fixes #69653
1 parent 6a730e1 commit bbf6766

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/cmd/go/internal/test/test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,10 +235,10 @@ control the execution of any test:
235235
Sets -cover.
236236
237237
-coverpkg pattern1,pattern2,pattern3
238-
Apply coverage analysis in each test to packages matching the patterns.
239-
The default is for each test to analyze only the package being tested.
240-
See 'go help packages' for a description of package patterns.
241-
Sets -cover.
238+
Apply coverage analysis in each test to packages and import paths
239+
matching the patterns. The default is for each test to analyze only the
240+
package being tested. See 'go help packages' for a description of
241+
package patterns. Sets -cover.
242242
243243
-cpu 1,2,4
244244
Specify a list of GOMAXPROCS values for which the tests, benchmarks or

src/cmd/go/internal/work/build.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,10 @@ and test commands:
104104
Sets -cover.
105105
-coverpkg pattern1,pattern2,pattern3
106106
For a build that targets package 'main' (e.g. building a Go
107-
executable), apply coverage analysis to each package matching
108-
the patterns. The default is to apply coverage analysis to
107+
executable), apply coverage analysis to each package and import path
108+
matching the patterns. The default is to apply coverage analysis to
109109
packages in the main Go module. See 'go help packages' for a
110-
description of package patterns. Sets -cover.
110+
description of package patterns. Sets -cover.
111111
-v
112112
print the names of packages as they are compiled.
113113
-work

0 commit comments

Comments
 (0)