Skip to content

cmd/go: panic in work.WriteCoverMetaFilesFile for "go test -n -cover" in root src dir  #67953

@thanm

Description

@thanm

On tip, I accidentally ran this command below in the root source directory (instead of a subdir).

$ cd `go env GOROOT`
$ cd src
$ go test -n -coverpkg=internal/coverage/decodecounter ./...

This should succeed, but instead I got this crash:

...
/w/go.master/pkg/tool/linux_amd64/compile -o $WORK/b2278/_pkg_.a -trimpath "$WORK/b2278=>" -p time/tzdata -std -complete -buildid kQeKaOUArGGmE6IQy2SI/kQeKaOUArGGmE6IQy2SI -c=4 -nolocalimports -importcfg $WORK/b2278/importcfg -pack ./time/tzdata/tzdata.go ./time/tzdata/zzipdata.go
/w/go.master/pkg/tool/linux_amd64/buildid -w $WORK/b2278/_pkg_.a # internal
panic: unexpected mode built-in package

goroutine 2504 [running]:
cmd/go/internal/work.WriteCoverMetaFilesFile(0xc001d92330?, {0x2f?, 0x0?}, 0xc000d0ef20)
	/w/go.master/src/cmd/go/internal/work/cover.go:116 +0x4a7
cmd/go/internal/work.ActorFunc.Act(0xc17ab8?, 0xfefb20?, {0xc17ab8?, 0xfefb20?}, 0xc00292df10?)
	/w/go.master/src/cmd/go/internal/work/action.go:76 +0x2d
cmd/go/internal/work.(*Builder).Do.func3({0xc17ab8, 0xfefb20}, 0xc000d0ef20)
	/w/go.master/src/cmd/go/internal/work/exec.go:152 +0x7a4
cmd/go/internal/work.(*Builder).Do.func4()
	/w/go.master/src/cmd/go/internal/work/exec.go:221 +0xae
created by cmd/go/internal/work.(*Builder).Do in goroutine 1
	/w/go.master/src/cmd/go/internal/work/exec.go:207 +0x3d1

What appears to be happening is that work.WriteCoverMetaFilesFile isn't properly handling dummy/builtin packages such as "unsafe" in this particular code path.

Metadata

Metadata

Assignees

Labels

FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions