]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: do not cover package unsafe
authorRob Pike <r@golang.org>
Mon, 13 Apr 2015 21:58:44 +0000 (14:58 -0700)
committerRob Pike <r@golang.org>
Tue, 14 Apr 2015 17:07:34 +0000 (17:07 +0000)
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>
src/cmd/go/test.go

index 03e9eeda9ba2d2608d77598757297bdbbce1e81d..22018f9372b53ed4a759644908177920b974b09c 100644 (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