GOOS specifies the target operating system for compiled Go code. Set it when building for a platform different from the machine running the build; ordinary builds use the machine’s environment value. section 12.1.1
Compile Go for WebAssembly
A small Go program can be compiled for a browser-based WebAssembly runtime with GOOS=js and GOARCH=wasm. The build produces main.wasm. On Windows, set the variables first, then run go build -o main.wasm. section 12.1.1
> GOOS=js GOARCH=wasm go build -o main.wasm
Use the executable build command to produce a WebAssembly binary with explicit target settings. section 12.1.1
