Mode:
Duration:
1
Coding works best on desktop or with an external keyboard.
Coding works best on desktop or with an external keyboard.
A basic Go program compiled to WebAssembly that writes 'Hello, Go WASM!' to the browser document.
# go/demo/main.go
package main
import (
"syscall/js"
)
func main() {
doc := js.Global().Get("document")
doc.Call("write", "Hello, Go WASM!")
select{}
}Go-WASM refers to compiling Go (Golang) programs to WebAssembly, allowing Go code to run in the browser. It enables developers to leverage Go's concurrency model and standard library on the client-side, interacting with JavaScript and the DOM.
Origin & Creator
Go-WASM is maintained by the Go project team at Google, introduced as part of Go 1.11 with WebAssembly as a supported compilation target.
Industrial Note
Go-WASM is ideal for Go developers who want to run Go code in the browser without rewriting logic in JavaScript or TypeScript, especially for apps needing Go's concurrency or existing Go code reuse.