golang WebAssembly

https://github.com/golang/go/wiki/WebAssembly

https://tutorialedge.net/golang/go-webassembly-tutorial/

1
2
3
4
5
6
7
package main

import "fmt"

func main() {
    fmt.Println("Hello, WebAssembly!")
}
1
2
3
4
5
gOOS=js GOARCH=wasm go build -o main.wasm
cp "$(go env GOROOT)/misc/wasm/wasm_exec.js" .
go get -u github.com/shurcooL/goexec
goexec 'http.ListenAndServe(":8080", http.FileServer(http.Dir(".")))'