]> Cypherpunks repositories - gostls13.git/commit
cmd/cover: add new "emit meta file" mode for packages without tests
authorThan McIntosh <thanm@google.com>
Fri, 5 May 2023 19:53:33 +0000 (15:53 -0400)
committerThan McIntosh <thanm@google.com>
Thu, 14 Sep 2023 19:44:37 +0000 (19:44 +0000)
commite356aa656d92ffd551e89edd9ed6ac00ea0278ef
tree316eecf822a0e268be5c0ae10d48c322733cf4bd
parent0b07bbd2be98f80f3d447a266803f1d68aee2902
cmd/cover: add new "emit meta file" mode for packages without tests

Introduce a new mode of execution for instrumenting packages that have
no test files. Instead of just skipping packages with no test files
(during "go test -cover" runs), the go command will invoke cmd/cover
on the package passing in an option in the config file indicating that
it should emit a coverage meta-data file directly for the package (if
the package has no functions, an empty file is emitted). Note that
this CL doesn't actually wire up this functionality in the Go command,
that will come in a later patch.

Updates #27261.
Updates #58770
Updates #24570.

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Change-Id: I01e8a3edb62441698c7246596e4bacbd966591c3
Reviewed-on: https://go-review.googlesource.com/c/go/+/495446
Reviewed-by: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
src/cmd/cover/cfg_test.go
src/cmd/cover/cover.go
src/cmd/cover/testdata/pkgcfg/b/b.go [deleted file]
src/cmd/cover/testdata/pkgcfg/b/b_test.go [deleted file]
src/cmd/cover/testdata/pkgcfg/main/main.go [deleted file]
src/cmd/cover/testdata/pkgcfg/noFuncsNoTests/nfnt.go [new file with mode: 0644]
src/cmd/cover/testdata/pkgcfg/yesFuncsNoTests/yfnt.go [new file with mode: 0644]
src/internal/coverage/covcmd/cmddefs.go