Revert "Figure out GOARM without being told (ref #1051)"
This reverts commit 2d7b0cf94d0ed5e9c9b97eca179e14d1b0d0c73b. GOARM is not actually embedded and printed by "go env"
This commit is contained in:
parent
cf00ab854f
commit
1219423091
31
build.go
31
build.go
@ -20,7 +20,6 @@ package main
|
|||||||
import (
|
import (
|
||||||
"archive/tar"
|
"archive/tar"
|
||||||
"archive/zip"
|
"archive/zip"
|
||||||
"bufio"
|
|
||||||
"bytes"
|
"bytes"
|
||||||
"compress/gzip"
|
"compress/gzip"
|
||||||
"flag"
|
"flag"
|
||||||
@ -76,18 +75,12 @@ func main() {
|
|||||||
case "386", "amd64", "armv5", "armv6", "armv7":
|
case "386", "amd64", "armv5", "armv6", "armv7":
|
||||||
break
|
break
|
||||||
case "arm":
|
case "arm":
|
||||||
// Grab GOARM from the environment
|
switch os.Getenv("GOARM") {
|
||||||
origGoArm := os.Getenv("GOARM")
|
|
||||||
if origGoArm == "" {
|
|
||||||
// Not found there, run "go env" to try to figure it out.
|
|
||||||
origGoArm = getGoEnv("GOARM")
|
|
||||||
}
|
|
||||||
switch origGoArm {
|
|
||||||
case "5", "6", "7":
|
case "5", "6", "7":
|
||||||
goarch += "v" + origGoArm
|
goarch += "v" + os.Getenv("GOARM")
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
log.Println("Invalid -goarch \"arm\". Use one of \"armv5\", \"armv6\", \"armv7\" or set GOARM.")
|
log.Println("Invalid goarch \"arm\". Use one of \"armv5\", \"armv6\", \"armv7\".")
|
||||||
log.Fatalln("Note that producing a correct \"armv5\" binary requires a rebuilt stdlib.")
|
log.Fatalln("Note that producing a correct \"armv5\" binary requires a rebuilt stdlib.")
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -456,24 +449,6 @@ func runPipe(file, cmd string, args ...string) {
|
|||||||
fd.Close()
|
fd.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
func getGoEnv(key string) string {
|
|
||||||
bs, err := runError("go", "env")
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
s := bufio.NewScanner(bytes.NewReader(bs))
|
|
||||||
for s.Scan() {
|
|
||||||
fields := strings.SplitN(s.Text(), "=", 2)
|
|
||||||
if len(fields) != 2 {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if fields[0] == key {
|
|
||||||
return strings.Trim(fields[1], `"`)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
type archiveFile struct {
|
type archiveFile struct {
|
||||||
src string
|
src string
|
||||||
dst string
|
dst string
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user