Releases: x1unix/go-playground
1.3.0
Changelog
This release adds experimental support for WebAssembly and Monaco editor customization options.
Options menu
New options are available in Settings menu:
Monaco editor customization
Monaco editor now can be customized. We added a several options for customization (like Mini map switch toggle):
WebAssembly support
In this release we added experimental WebAssembly support.
By experimental we mean that some things might not work correctly, since we had to adapt wasm_exec.js
bridge from Go SDK to connect Go programs to playground's UI and something can be broken.
WebAssembly to run Go programs locally in browser and also to call JavaScript on page. Your browser should support this technology in order to use it (see: caniuse.com).
Despite this, running Go programs in browser introduce some limitations: program has no access to file system and HTTP requests are limited to browser security model (CORS). See Go documentation for more intormation.
In future, we plan to mock filesystem (and maybe some other IO's) to make it able to play with them in playground.
To enable WebAssembly, go to Settings and in Build tab select WebAssembly
runtime:
Browser communication
You can call JavaScript functions using syscall/js
package.
Here is basic example that shows a simple alert:
package main
import (
"fmt"
"syscall/js"
)
func main() {
fmt.Println("Hello World")
js.Global().Call("alert", "hello")
}