Skip to content

wasm-go is a module that is designed to compile a WebAssembly module from Go. There is a publication for this repository which can be found at https://pascalallen.medium.com/how-to-compile-a-webassembly-module-from-go-a9ed5f831582.

Notifications You must be signed in to change notification settings

pascalallen/wasm-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wasm-go

wasm-go is a module that is designed to compile a WebAssembly module from Go. There is a publication for this repository which can be found here.

Prerequisites

WebAssembly Compilation Steps

Compile the project's Go module to WebAssembly

cd app/ && GOOS=js GOARCH=wasm go build -o ../public/app.wasm

Copy the compiled JavaScript WebAssembly support file to the project

cp "$(go env GOROOT)/misc/wasm/wasm_exec.js" ../public/app.js

Run the project's web server from project root

go run webserver.go

Navigate to http://localhost:9990/, open the JavaScript debug console, and you should see the output. You can modify the program, rebuild app.wasm, and refresh to see new output.

About

wasm-go is a module that is designed to compile a WebAssembly module from Go. There is a publication for this repository which can be found at https://pascalallen.medium.com/how-to-compile-a-webassembly-module-from-go-a9ed5f831582.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages