Repository
Current version released
5 years ago
GoDeno
A simple port of Golang’s JS/WASM glue code to Deno in TypeScript. Credit to the Go team for their amazing work on getting Go working in WASM!
Usage
- Create a new
Goclass - Create a new WASM instance with the
importObjecton the newGoobject. - Run
go.run(wasmInstance)with your WASM instance.
Example Code:
import Go from "mod.ts"
let go = new Go();
let inst = await WebAssembly.instantiate(Deno.readFileSync("code.wasm"), go.importObject);
let promise = go.run(inst);
let value = go.exports.coolFunction();
console.log("Go returned: " + value);The exports object is whatever the Go program set on the global scope.
Things tested working:
- Filesystem read
- fmt println
- basic functionality
Other things should work, but may not have been tested. Deno doesn’t support gid and a few other things that Go relies on from the node.js libraries. They have been filled with dummy functions.