Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ruslanguns/webassembly-golang
Go via WebAssembly
https://github.com/ruslanguns/webassembly-golang
Last synced: 7 days ago
JSON representation
Go via WebAssembly
- Host: GitHub
- URL: https://github.com/ruslanguns/webassembly-golang
- Owner: ruslanguns
- Created: 2022-12-10T13:15:02.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-12-15T08:24:45.000Z (11 months ago)
- Last Synced: 2024-05-28T17:08:59.026Z (6 months ago)
- Language: JavaScript
- Size: 142 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## WebAssembly using Go in the Browser
This is a proof of concept where I'm testing golang in the browser.
## Requirements
To build your Go code you could you tinygo with the following command:
```bash
tinygo build -o main.wasm -target=wasm main.go
```You can either use Docker to generate this build:
```bash
docker run --rm -v $(pwd):/src tinygo/tinygo:latest cp $(tinygo env TINYGOROOT)/targets/wasm_exec.js wasm_exec_tiny.js
docker run --rm -v $(pwd):/src tinygo/tinygo:latest tinygo build -o /src/build/go.wasm -target=wasm /src/cmd/main.go
```Once it's generated you can import using the Webassembly API.