From: Rob Pike Date: Mon, 13 Apr 2015 21:58:44 +0000 (-0700) Subject: cmd/go: do not cover package unsafe X-Git-Tag: go1.5beta1~1122 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=eba38fd7800398f19d3e7d7ded6d2bca85ed056f;p=gostls13.git 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 --- diff --git a/src/cmd/go/test.go b/src/cmd/go/test.go index 03e9eeda9b..22018f9372 100644 --- a/src/cmd/go/test.go +++ b/src/cmd/go/test.go @@ -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