Commit 5c7f9442 authored by Brad Fitzpatrick's avatar Brad Fitzpatrick

cmd/internal/obj: validate GOARM environment variable's value before use

I was previously setting GOARM=arm5 (due to confusion with previously
seeing buildall.sh's temporary of "arm5" as a GOARCH and
misremembernig), but GOARM=arm5 was acting like GOARM=5 only on
accident. See https://go-review.googlesource.com/#/c/10023/

Instead, fail if GOARM is not a known value.

Change-Id: I9ba4fd7268df233d40b09f0431f37cd85a049847
Reviewed-on: https://go-review.googlesource.com/10024Reviewed-by: 's avatarMinux Ma <minux@golang.org>
parent fd5b8aa7
......@@ -213,10 +213,17 @@ func Getgoos() string {
}
func Getgoarm() string {
return envOr("GOARM", defaultGOARM)
switch v := envOr("GOARM", defaultGOARM); v {
case "5", "6", "7":
return v
}
// Fail here, rather than validate at multiple call sites.
log.Fatalf("Invalid GOARM value. Must be 5, 6, or 7.")
panic("unreachable")
}
func Getgo386() string {
// Validated by cmd/8g.
return envOr("GO386", defaultGO386)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment