unix: allow overriding GOOS using GOOS_TARGET in mksyscall.go

The syscall wrapper generator utility is platform independent and can in
principle be run on a GOOS other than the one we're generating the
syscall wrappers for. Allow overriding GOOS by setting GOOS_TARGET,
similar to other generator programs in the repo.

Also remove the unused GOARCH_TARGET override in the same file.

Change-Id: I91459113af9f662f12a99b99c581c7f2615cb394
Reviewed-on: https://go-review.googlesource.com/c/sys/+/256278
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Tobias Klauser
2020-09-21 15:12:56 +02:00
committed by Tobias Klauser
parent af09f7315a
commit cb7fb32132

View File

@@ -86,16 +86,14 @@ func parseParam(p string) Param {
}
func main() {
// Get the OS and architecture (using GOARCH_TARGET if it exists)
goos := os.Getenv("GOOS")
goos := os.Getenv("GOOS_TARGET")
if goos == "" {
goos = os.Getenv("GOOS")
}
if goos == "" {
fmt.Fprintln(os.Stderr, "GOOS not defined in environment")
os.Exit(1)
}
goarch := os.Getenv("GOARCH_TARGET")
if goarch == "" {
goarch = os.Getenv("GOARCH")
}
// Check that we are using the Docker-based build system if we should
if goos == "linux" {