]> Cypherpunks repositories - gostls13.git/commitdiff
goinstall: fix build
authorRuss Cox <rsc@golang.org>
Mon, 7 Mar 2011 16:33:26 +0000 (11:33 -0500)
committerRuss Cox <rsc@golang.org>
Mon, 7 Mar 2011 16:33:26 +0000 (11:33 -0500)
func init runs *after* var declarations

TBR=niemeyer
CC=golang-dev
https://golang.org/cl/4260055

src/cmd/goinstall/syslist_test.go

index a660e69193e2f25328fdbf848c66eccf0f1ff94e..795cd293ab9ca40cec852043f7c57a06c15d6b8e 100644 (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 {