Skip to content
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

compiler/natives: use embed package #1151

Merged
merged 2 commits into from Sep 21, 2022
Merged

compiler/natives: use embed package #1151

merged 2 commits into from Sep 21, 2022

Conversation

dmitshur
Copy link
Member

@dmitshur dmitshur commented Sep 18, 2022

Simplify the code and GopherJS development experience slightly where possible.
(Individual commit messages provide more information.)

For #1149.

The natives package has a blank import of the vfsgen package so that
it stays included in go.mod (otherwise go mod tidy considers it as
unused and removes it). Copy that mechanism here.

Place it under a file with a "generate" build constraint so it doesn't
get included in a normal gopherjs build, since it's only needed during
code generation.
It's now possible to use the new embed package in the standard library
to simplify the implementation of natives.FS and reduce its dependence
on packages outside the standard library.

This also drops support for the gopherjsdev tag where the natives could
be read directly from disk without regenerating and rebuilding the
gopherjs binary. That mode is less helpful now that file changes can be
picked up just by rebuilding (without regenerating).
It also can't be made to work reliably in module mode since module mode
doesn't have the concept of a system-wide always-present workspace like
GOPATH mode had. One-off occasional needs can probably be better served
by temporary local code changes instead.
@dmitshur dmitshur enabled auto-merge (rebase) September 18, 2022 19:26
@github-actions
Copy link

Reference app: jQuery TodoMVC (acf500a6c32a83d8c4582d967b09a65febf0e120)

BRANCH ORIGINAL MINIFIED COMPRESSED (GZIP)
Pull request (embed-natives) 2,882,014 bytes 1,898,222 bytes 381,357 bytes
Target branch (master) 0.00% increase (0 bytes) 0.00% increase (0 bytes) 0.00% increase (0 bytes)

#outputSize

@dmitshur dmitshur merged commit e13d1c9 into master Sep 21, 2022
@nevkontakte nevkontakte deleted the embed-natives branch September 21, 2022 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants