Skip to content

Commit

Permalink
unix: allow overriding GOOS using GOOS_TARGET in mkpost.go
Browse files Browse the repository at this point in the history
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 <[email protected]>
Auto-Submit: Tobias Klauser <[email protected]>
TryBot-Result: Gopher Robot <[email protected]>
Reviewed-by: Ian Lance Taylor <[email protected]>
Reviewed-by: David Chase <[email protected]>
  • Loading branch information
tklauser authored and gopherbot committed Apr 14, 2023
1 parent dbd8f99 commit 3125361
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion unix/mkpost.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 3125361

Please sign in to comment.