From 3125361ba60fc0325a24bd4aead72374768fc216 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Thu, 13 Apr 2023 23:58:33 +0200 Subject: [PATCH] unix: allow overriding GOOS using GOOS_TARGET in mkpost.go mkpost.go 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. This e.g. allows testing mkpost.go changes on a different GOOS. Follows CL 256278 which did the same for mksyscall.go Change-Id: Ib99aa5cd266f7d27543cf9433cfb028f367eef63 Reviewed-on: https://go-review.googlesource.com/c/sys/+/484636 Run-TryBot: Tobias Klauser Auto-Submit: Tobias Klauser TryBot-Result: Gopher Robot Reviewed-by: Ian Lance Taylor Reviewed-by: David Chase --- unix/mkpost.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/unix/mkpost.go b/unix/mkpost.go index ec31df2c5..5624847c6 100644 --- a/unix/mkpost.go +++ b/unix/mkpost.go @@ -24,7 +24,10 @@ import ( 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") + } goarch := os.Getenv("GOARCH_TARGET") if goarch == "" { goarch = os.Getenv("GOARCH")