]> Cypherpunks repositories - gostls13.git/commitdiff
go/types: fix build: use the right compiler to compile test case
authorRobert Griesemer <gri@golang.org>
Fri, 8 Apr 2011 05:10:39 +0000 (22:10 -0700)
committerRobert Griesemer <gri@golang.org>
Fri, 8 Apr 2011 05:10:39 +0000 (22:10 -0700)
R=rsc
CC=golang-dev
https://golang.org/cl/4369050

src/pkg/go/types/gcimporter_test.go

index 387874877afd2a906f0fd2e5abd76727ff26d956..556e761df2db61112be2a68697415e1b443ee124 100644 (file)
@@ -7,8 +7,8 @@ package types
 import (
        "exec"
        "io/ioutil"
-       "os"
        "path/filepath"
+       "runtime"
        "strings"
        "testing"
        "time"
@@ -18,15 +18,20 @@ import (
 var gcName, gcPath string // compiler name and path
 
 func init() {
-       // find a compiler
-       for _, char := range []string{"5", "6", "8"} {
-               var err os.Error
-               gcName = char + "g"
-               gcPath, err = exec.LookPath(gcName)
-               if err == nil {
-                       return
-               }
+       // determine compiler
+       switch runtime.GOARCH {
+       case "386":
+               gcName = "8g"
+       case "amd64":
+               gcName = "6g"
+       case "arm":
+               gcName = "5g"
+       default:
+               gcName = "unknown-GOARCH-compiler"
+               gcPath = gcName
+               return
        }
+       gcPath, _ = exec.LookPath(gcName)
 }