]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: go test -i correctly handle cgo packages
authorShenghou Ma <minux.ma@gmail.com>
Wed, 15 Feb 2012 18:26:22 +0000 (13:26 -0500)
committerRuss Cox <rsc@golang.org>
Wed, 15 Feb 2012 18:26:22 +0000 (13:26 -0500)
Previous CL (5674043) omit the case where runtime/cgo itself is out-of-date.
Fixes #2936 (again).

R=rsc
CC=golang-dev
https://golang.org/cl/5674048

src/cmd/go/test.go

index a291262b3f80a72f07f8ed4277b3536f5142ba76..8c88ea0b02260df39cb81e7ea1e260375d509f89 100644 (file)
@@ -15,6 +15,7 @@ import (
        "os/exec"
        "path"
        "path/filepath"
+       "runtime"
        "sort"
        "strings"
        "text/template"
@@ -273,8 +274,15 @@ func runTest(cmd *Command, args []string) {
                        }
                }
 
+               // translate C to runtime/cgo
+               if deps["C"] {
+                       delete(deps, "C")
+                       deps["runtime/cgo"] = true
+                       if buildContext.GOOS == runtime.GOOS && buildContext.GOARCH == runtime.GOARCH {
+                               deps["cmd/cgo"] = true
+                       }
+               }
                // Ignore pseudo-packages.
-               delete(deps, "C")
                delete(deps, "unsafe")
 
                all := []string{}