Thanks to visit codestin.com
Credit goes to github.com

Skip to content

GopherJS should use GOOS=js instead of build.Default.GOOS #991

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
nevkontakte opened this issue Mar 8, 2021 · 2 comments
Closed

GopherJS should use GOOS=js instead of build.Default.GOOS #991

nevkontakte opened this issue Mar 8, 2021 · 2 comments

Comments

@nevkontakte
Copy link
Member

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:

  1. 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.
  2. 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.

@flimzy @neelance @dmitshur any thoughts?

@dmitshur
Copy link
Member

dmitshur commented Mar 8, 2021

If I understand correctly, this suggestion is the same as issue #693.

@nevkontakte 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
@nevkontakte
Copy link
Member Author

Indeed, thanks for pointing that out. I'll close this as a duplicate then.

nevkontakte added a commit to nevkontakte/gopherjs that referenced this issue 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.
nevkontakte added a commit that referenced this issue Mar 9, 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 #991), but this lets the package compile for now.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants