mirror of
https://github.com/golang/go
synced 2024-11-14 14:00:25 -07:00
cmd/go: fix handling of builtin packages in WriteCoverMetaFilesFile
In certain unusual situations we can wind up with a build action for a dummy (built-in) package as a dependency for the writeCoverMeta pseudo-action generated when -coverpkg is in effect; this was causing a panic in WriteCoverMetaFilesFile when it discovered a predecessor whose Mode field was not "build". Update the code that constructs deps for writeCoverMeta action to skip dummy builds. Fixes #67953. Change-Id: If747aeb9bae061c84290d1e10f6ea7abb0828aca Reviewed-on: https://go-review.googlesource.com/c/go/+/592202 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Matloob <matloob@golang.org>
This commit is contained in:
parent
6d93de2c11
commit
1683628d29
@ -1067,7 +1067,7 @@ func builderTest(b *work.Builder, ctx context.Context, pkgOpts load.PackageOpts,
|
||||
Package: p,
|
||||
IgnoreFail: true, // run (prepare output) even if build failed
|
||||
}
|
||||
if writeCoverMetaAct != nil {
|
||||
if writeCoverMetaAct != nil && build.Actor != nil {
|
||||
// There is no real "run" for this package (since there
|
||||
// are no tests), but if coverage is turned on, we can
|
||||
// collect coverage data for the code in the package by
|
||||
|
7
src/cmd/go/testdata/script/test_n_cover_std.txt
vendored
Normal file
7
src/cmd/go/testdata/script/test_n_cover_std.txt
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
# Issue 67953: test to make sure that the go commands static coverage
|
||||
# meta-data handling code handles pseudo-packages (ex: "unsafe") properly.
|
||||
|
||||
[short] skip
|
||||
|
||||
cd $GOROOT/src
|
||||
go test -vet=off -p=1 -n -coverpkg=internal/coverage/decodecounter internal/coverage/decodecounter sync unsafe
|
Loading…
Reference in New Issue
Block a user