go-playground

Better Go Playground powered by React and Monaco editor

MIT License

Stars
1.2K
Committers
6

Bot releases are visible (Hide)

go-playground - 1.4.1

Published by x1unix over 4 years ago

Changelog

go-playground - 1.4.0

Published by x1unix over 4 years ago

Changelog

This minor release adds Go code errors report in editor

Go code errors report

image

We added background code syntax checker based on go/parser package. Checker is written in Go and compiled as WebAssembly binary.

If your browser supports WebAssembly, checker will start in separate worker thread and will report for syntax error in your code on code change.

go-playground - 1.3.0

Published by x1unix over 4 years ago

Changelog

This release adds experimental support for WebAssembly and Monaco editor customization options.

Options menu

New options are available in Settings menu:
image

Monaco editor customization

Monaco editor now can be customized. We added a several options for customization (like Mini map switch toggle):

image

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:

image

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")
}

image

go-playground - 1.2.0

Published by x1unix over 4 years ago

  • fix: add ParseComments parser flag
  • Provide methods documentation
  • Wrap code snippets from GoDoc comments into markdown
go-playground - 1.1.0

Published by x1unix over 4 years ago

  • Add Share snippet option
  • Move "Run" button to right side
  • Improve code complete for signature methods

See: https://github.com/x1unix/go-playground/pull/2

go-playground -

Published by x1unix over 4 years ago