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

Golang has WebAssembly support now, version 1.11 added wasm support #1

Open
renatosans opened this issue Sep 3, 2018 · 11 comments
Open

Comments

@renatosans
Copy link

No description provided.

@xtuc
Copy link
Member

xtuc commented Sep 4, 2018

Yes, would you mind sending a PR to update the setup here? and the doc?

@aaronpowell
Copy link

Seems not to be that simple, things go boom with Go 1.11.4:

preprocessFailed to decode custom "name" section @2475058; ignoring (integer representation too long).
 OK
decode(node:15186) UnhandledPromiseRejectionWarning: Error: integer too large
    at Object.decodeUInt32 (/c/_Projects/github/golang/node_modules/@webassemblyjs/leb128/lib/leb.js:288:11)
    at decodeUInt32 (/c/_Projects/github/golang/node_modules/@webassemblyjs/leb128/lib/index.js:46:23)
    at readU32 (/c/_Projects/github/golang/node_modules/@webassemblyjs/wasm-parser/lib/decoder.js:232:34)
    at parseSection (/c/_Projects/github/golang/node_modules/@webassemblyjs/wasm-parser/lib/decoder.js:1273:15)
    at Object.decode (/c/_Projects/github/golang/node_modules/@webassemblyjs/wasm-parser/lib/decoder.js:1638:25)
    at decode (/c/_Projects/github/golang/node_modules/@webassemblyjs/wasm-parser/lib/index.js:248:21)
    at compileSource.then.bin (/c/_Projects/github/golang/loader.js:118:19)
    at process.internalTickCallback (internal/process/next_tick.js:77:7)
(node:15186) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:15186) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

My guess is that the structure of the WASM generated by the Go compiler has changed since the @webassembly dependencies were written.

@xtuc
Copy link
Member

xtuc commented Jan 15, 2019

@aaronpowell this looks more to me like an encoding issue. @webassemblyjs/* (i'm the author) has its integer decoding passing the spec tests.

Would you mind trying to load the Wasm module into a Node.js instance or could you please send me it?

@aaronpowell
Copy link

Done:

$> GOOS=js GOARCH=wasm go run -exec="$(go env GOROOT)/misc/wasm/go_js_wasm_exec" .
2019/01/16 10:20:33 test

It appears to execute the main function as expected.

@xtuc
Copy link
Member

xtuc commented Jan 16, 2019

Ok, thanks for the confirmation, it's definetly a bug on our side. Could you please send me your wasm module? You can send it to my email privately.

@aaronpowell
Copy link

aaronpowell commented Jan 16, 2019 via email

@xtuc
Copy link
Member

xtuc commented Jan 16, 2019

Ok, I'll investigate that. It's most likely something is not up-to-date here.

@aaronpowell
Copy link

aaronpowell commented Jan 16, 2019 via email

@xtuc
Copy link
Member

xtuc commented Jan 17, 2019

I pushed a couple of updates (example was broken for me) and I can produce it.

@xtuc
Copy link
Member

xtuc commented Feb 5, 2019

Sorry for the delay here, I'll work on it asap.

@aaronpowell
Copy link

No problem. I actually built my own because I was wanting to learn more about how WASM works, how Go works and how webpack works: https://github.com/aaronpowell/webpack-golang-wasm-async-loader

I am keen to see this one in action too, it approaches a few things differently to mine.

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

No branches or pull requests

3 participants