1
0
mirror of https://github.com/golang/go synced 2024-11-22 10:04:42 -07:00

go/types: fix build: use the right compiler to compile test case

R=rsc
CC=golang-dev
https://golang.org/cl/4369050
This commit is contained in:
Robert Griesemer 2011-04-07 22:10:39 -07:00
parent 1baffa7da0
commit 0ada4a2d62

View File

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