1
0
mirror of https://github.com/golang/go synced 2024-10-02 18:18:33 -06:00

goinstall: fix build

func init runs *after* var declarations

TBR=niemeyer
CC=golang-dev
https://golang.org/cl/4260055
This commit is contained in:
Russ Cox 2011-03-07 11:33:26 -05:00
parent 4371e09457
commit 5946e46138

View File

@ -11,17 +11,22 @@ import (
var (
thisOS = runtime.GOOS
thisArch = runtime.GOARCH
otherOS = "freebsd"
otherArch = "arm"
otherOS = anotherOS()
otherArch = anotherArch()
)
func init() {
if thisOS == otherOS {
otherOS = "linux"
func anotherOS() string {
if thisOS != "darwin" {
return "darwin"
}
if thisArch == otherArch {
otherArch = "amd64"
return "linux"
}
func anotherArch() string {
if thisArch != "amd64" {
return "amd64"
}
return "386"
}
type GoodFileTest struct {