From cb7fb321323f6cde6c2bec9fdb8dbaa14f17d6b6 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Mon, 21 Sep 2020 15:12:56 +0200 Subject: [PATCH] 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 Run-TryBot: Tobias Klauser TryBot-Result: Go Bot Reviewed-by: Ian Lance Taylor --- unix/mksyscall.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/unix/mksyscall.go b/unix/mksyscall.go index f6678425..a8d73bb9 100644 --- a/unix/mksyscall.go +++ b/unix/mksyscall.go @@ -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" {