1
0
mirror of https://github.com/golang/go synced 2024-11-22 04:04:40 -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 (
"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)
}