-
Notifications
You must be signed in to change notification settings - Fork 569
Closed
Labels
Description
Currently GopherJS specifies GOOS = build.Default.GOOS
when it sets up its build context.
This is problematic because when, for example, building on Linux all sources with linux
build tag will be picked up unless they explicitly specify !js
, which in the standard library mostly isn't the case. This is not great for a two reasons:
- We try to build a lot of standard library stuff we probably don't need (e.g. the
internal/syscall/unix
package). This is very likely leads to unnecessary output bloat. - Output may differ when building on hosts with a different os despite the fact that we are targeting the same execution environment (browser or node).
I think it is better to use GOOS=js
at all times to avoid both problems. This will also improve consistency with WebAssembly, which also uses GOOS=js
(and GOARCH=wasm
).
However, this is a potentially breaking change since people might be expecting GopherJS to pick up linux/windows/whatever code, even though I can't think of a reason why.