diff options
| author | Brad Fitzpatrick <bradfitz@golang.org> | 2013-08-24 09:51:42 -0500 |
|---|---|---|
| committer | Brad Fitzpatrick <bradfitz@golang.org> | 2013-08-24 09:51:42 -0500 |
| commit | cb79c57dfa25b917c4ce1c08e2a9a6f9405a5998 (patch) | |
| tree | 192bddc0b7b6dd088729790693be606e212ed887 /src/cmd/api | |
| parent | 33f3dffa7c3105b98e40c417df577683e341be87 (diff) | |
| download | go-cb79c57dfa25b917c4ce1c08e2a9a6f9405a5998.tar.xz | |
cmd/api: ignore GOARCH when building cmd/api.
This was breaking people setting GOARCH=386 before running
all.bash on amd64 machines.
cmd/go puts different architecture binaries where "go tool"
can't find them.
R=golang-dev, r, khr
CC=golang-dev
https://golang.org/cl/13139044
Diffstat (limited to 'src/cmd/api')
| -rw-r--r-- | src/cmd/api/run.go | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/cmd/api/run.go b/src/cmd/api/run.go index d824651b81..a13d9a5496 100644 --- a/src/cmd/api/run.go +++ b/src/cmd/api/run.go @@ -21,6 +21,7 @@ import ( "os/exec" "path/filepath" "strconv" + "strings" ) // goToolsVersion is the hg revision of the go.tools subrepo we need @@ -45,7 +46,7 @@ func main() { gopath := prepGoPath() cmd := exec.Command("go", "install", "--tags=api_tool", "cmd/api") - cmd.Env = append([]string{"GOPATH=" + gopath}, os.Environ()...) + cmd.Env = append([]string{"GOPATH=" + gopath}, filterOut(os.Environ(), "GOARCH")...) out, err := cmd.CombinedOutput() if err != nil { log.Fatalf("Error installing cmd/api: %v\n%s", err, out) @@ -61,6 +62,22 @@ func main() { fmt.Print(string(out)) } +// filterOut returns a copy of the src environment without environment +// variables from remove. +// TODO: delete when issue 6201 is fixed. +func filterOut(src []string, remove ...string) (out []string) { +S: + for _, s := range src { + for _, r := range remove { + if strings.HasPrefix(s, r) && strings.HasPrefix(s, r+"=") { + continue S + } + } + out = append(out, s) + } + return +} + // file expands s to $GOROOT/api/s.txt. // If there are more than 1, they're comma-separated. func file(s ...string) string { |
