Skip to content

Commit 3125361

Browse files
tklausergopherbot
authored andcommitted
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 <tobias.klauser@gmail.com> Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: David Chase <drchase@google.com>
1 parent dbd8f99 commit 3125361

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

unix/mkpost.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ import (
2424

2525
func main() {
2626
// Get the OS and architecture (using GOARCH_TARGET if it exists)
27-
goos := os.Getenv("GOOS")
27+
goos := os.Getenv("GOOS_TARGET")
28+
if goos == "" {
29+
goos = os.Getenv("GOOS")
30+
}
2831
goarch := os.Getenv("GOARCH_TARGET")
2932
if goarch == "" {
3033
goarch = os.Getenv("GOARCH")

0 commit comments

Comments
 (0)