cmd/go: do not cover package unsafe

Even if requested, there is no .go file for unsafe - it comes from the
compiler - so referencing its cover variables will break the compilation
in a command like
	go test -coverpkg=all fmt

Fixes #10408.

Change-Id: If92658ef6c29dc020f66ba30b02eaa796f7205e0
Reviewed-on: https://go-review.googlesource.com/8891
Reviewed-by: Russ Cox <rsc@golang.org>
This commit is contained in:
Rob Pike 2015-04-13 14:58:44 -07:00
parent 24f246c1b6
commit eba38fd780
1 changed files with 4 additions and 0 deletions

View File

@ -430,6 +430,10 @@ func runTest(cmd *Command, args []string) {
// Mark all the coverage packages for rebuilding with coverage.
for _, p := range testCoverPkgs {
// There is nothing to cover in package unsafe; it comes from the compiler.
if p.ImportPath == "unsafe" {
continue
}
p.Stale = true // rebuild
p.fake = true // do not warn about rebuild
p.coverMode = testCoverMode