You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently GopherJS specifiesGOOS = 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.
If I understand correctly, this suggestion is the same as issue #693.
nevkontakte
changed the title
GopherJS should use GOOS=js instead of build.Default.GOOD
GopherJS should use GOOS=js instead of build.Default.GOOS
Mar 8, 2021
Looks like a few new functions were added to the package, with a few new
constants. Neither of them are really relevant in the JS context and
arguably we shouldn't be compiling this code in the first place (see
issue gopherjs#991), but this lets the package compile for now.
Looks like a few new functions were added to the package, with a few new
constants. Neither of them are really relevant in the JS context and
arguably we shouldn't be compiling this code in the first place (see
issue #991), but this lets the package compile for now.
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:internal/syscall/unix
package). This is very likely leads to unnecessary output bloat.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 usesGOOS=js
(andGOARCH=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.
@flimzy @neelance @dmitshur any thoughts?
The text was updated successfully, but these errors were encountered: