Description
The GopherJS compiler supports building output only for GOARCH=js value, and any GOOS value.
That means it will produce valid and different output for this Go package, depending on which GOOS value is used:
// +build plan9
package p
const Message = "It was a hot summer..."
// +build !plan9
package p
const Message = "It was a cold winter..."
Of course, it also supports cross-compiling, so one can produce different outputs by doing:
$ GOOS=plan9 gopherjs build
# hot summer
$ GOOS=solaris gopherjs build
# cold winter
I propose we limit support to just a single fixed GOOS value.
This is primarily meant to apply to the Go standard library, which we must manually apply overrides for in order to get it to build and work correctly for GOARCH=js. See https://github.com/gopherjs/gopherjs/commits/master/compiler/natives/src. However, I think we should apply for all packages for simplicity/consistency. Applying the limit to just Go stdlib but not 3rd party packages would be weird and unnecessary.
The motivation is simple. It costs a lot of developer time to support Go standard library for GopherJS. Right now, I don't think this project can afford to continue to support all GOOS values. It's an open source project, with no funding, and most of the progress is made by volunteers contributing in their spare time in after work hours.
The value gained from supporting multiple GOOS values is small. The cost is prohibitively high.
The compiler will continue to be able to (theoretically) compile for many GOOS values, we're just not going to support GOOS values other than a single one that we pick.