The full power of the Go Compiler directly in your browser, including a virtual file system implementation. Deployable as a static website.

Static Go Playground

MIT license Build

Features

  • Full Go Compiler running on the browser.
    • Supports using custom build tags.
    • Incremental builds (build cache).
    • Supports multiple files and packages (including dependencies).
    • Full cross-compiling support directly from your browser.
    • No need for a server backend to build executables.
    • Easy deployment (just upload the generated files).
  • Full filesystem abstraction for both the compiler and running programs.
    • A standalone wasm_exec.js with filesystem support is available.
  • Full DOM access for running programs (and basic stdout/stderr for now).
  • Browser-based code editor (Ace).

Try it out!

Compiling and running examples from Ebiten:

Go Playground demo

Compiling and running modified examples:

Go Playground editor demo

Use this to provide editable demos for your projects!

Instructions

  1. Run go mod vendor on your Go Module root.
  2. Zip the project and upload it anywhere.
    1. Check that there are no CORS errors.
    2. You may use CI to perform these steps automatically, like this workflow for ebiten.
  3. Publish the URL that automatically loads and builds your project.
    1. Take a look at setup.ts for more information on startup automation.
    2. For example, to automatically download ebiten's sources, build and run an example use this URL.

How does it work?

This project builds the Go Compiler to WebAssembly and provides enough abstractions, fixes and hacks for it to be able to build executables (for any platform) from the web. The main added abstraction is a virtual file system implementation that works in memory (based on virtualfs), which can also be used separately with a custom wasm_exec.js. The frontend also runs the compiled code (if the target arch is js/wasm), with the same features available.

The result is a static website that can compile and run most Go code (see known limitations below) from the client's browser.

Why? To learn how the Go compiler works and to provide better (hackable) demos for most Go projects with easy deployment.

Standard library

There are 2 approaches to handle the standard library:

  • Precompiling it while building the compiler: faster first compilation but requires a bigger (slower) initial download and only supports building for one OS/arch, unless another precompiled library is downloaded.
  • Compiling the standard library from the browser (only the required packages): It allows to cross-compile to any OS/arch supported by Go at the cost of an slower initial build: compiled artifacts are cached once built for the first time (this happens automatically for all packages with unmodified sources).

A mix of both was applied: the precompiled standard library for js/wasm is downloaded. Cross-compiling is also possible because the source code of the standard library is downloaded and used for any other OS/arch.

Builds

You can download production builds from the releases or the github pages branch.

Building from source

Dependencies:

  • Go Compiler (Go 1.13 or later)
  • node and npm/yarn
  • Very common UNIX tools.

Just run make: it will output a static site to dist/ that can be uploaded to any web server. To learn how it works, start by looking at the Makefile.

To only generate the modified wasm_exec.js (already embedded if using the main app), run make wasm_exec.

Known limitations

  • Limitations of building on js/wasm:
    • No Cgo support.
  • Limitations of running on js/wasm:
    • Limited network access (available: HTTP client, WebRTC...).
    • Limited persistent storage (not implemented yet, could be blocked/deleted by user).
  • Dependencies must be vendored (due to limited network access).
  • Slower than the native compiler, and may run out of memory for large projects.

Related projects

Updated: 03/2022

  • The official Go Playground (link): limited execution time, no DOM access, no output until the program finishes, limited multi-package support.
  • Better Go Playground (link): has an experimental webassembly runtime, but includes no filesystem abstraction and still requires a server backend to build the webassembly modules, no multi-package support.
  • pdfcpu (link): Example of running a Go CLI tool on the web browser, inspiration for this project.
  • Wasm go playground (link): No standard library, no dependencies, no multi-file support, no cross-compilation, inspiration for this project
  • Go Playground WASM (link): Actually compiles Goscript (a script language like Python or Lua written in Rust, with exactly the same syntax as Go's) instead of using the official Go Compiler.
Similar Resources

rtop is an interactive, remote system monitoring tool based on SSH

rtop rtop is a remote system monitor. It connects over SSH to a remote system and displays vital system metrics (CPU, disk, memory, network). No speci

Dec 30, 2022

distributed monitoring system

distributed monitoring system

OWL OWL 是由国内领先的第三方数据智能服务商 TalkingData 开源的一款企业级分布式监控告警系统,目前由 Tech Operation Team 持续开发更新维护。 OWL 后台组件全部使用 Go 语言开发,Go 语言是 Google 开发的一种静态强类型、编译型、并发型,并具有垃圾回

Dec 24, 2022

An Open Source video surveillance management system for people making this world a safer place.

An Open Source video surveillance management system for people making this world a safer place.

Kerberos Open Source Docker Hub | Documentation | Website Kerberos Open source (v3) is a cutting edge video surveillance management system made availa

Dec 30, 2022

A system and resource monitoring tool written in Golang!

A system and resource monitoring tool written in Golang!

Grofer A clean and modern system and resource monitor written purely in golang using termui and gopsutil! Currently compatible with Linux only. Curren

Jan 8, 2023

An open-source and enterprise-level monitoring system.

 An open-source and enterprise-level monitoring system.

Falcon+ Documentations Usage Open-Falcon API Prerequisite Git = 1.7.5 Go = 1.6 Getting Started Docker Please refer to ./docker/README.md. Build from

Jan 1, 2023

OS system statistics library for Go

OS system statistics library for Go This is a library to get system metrics like cpu load and memory usage. The library is created for mackerel-agent.

Dec 9, 2022

Distributed simple and robust release management and monitoring system.

Distributed simple and robust release management and monitoring system.

Agente Distributed simple and robust release management and monitoring system. **This project on going work. Road map Core system First worker agent M

Nov 17, 2022

checkah is an agentless SSH system monitoring and alerting tool.

CHECKAH checkah is an agentless SSH system monitoring and alerting tool. Features: agentless check over SSH (password, keyfile, agent) config file bas

Oct 14, 2022

An example logging system using Prometheus, Loki, and Grafana.

An example logging system using Prometheus, Loki, and Grafana.

Logging Example Structure Collector Export numerical data for Prometheus and log data for Promtail. Exporter uses port 8080 Log files are saved to ./c

Nov 21, 2022
Comments
  • Bump terser from 5.12.1 to 5.14.2 in /frontend

    Bump terser from 5.12.1 to 5.14.2 in /frontend

    Bumps terser from 5.12.1 to 5.14.2.

    Changelog

    Sourced from terser's changelog.

    v5.14.2

    • Security fix for RegExps that should not be evaluated (regexp DDOS)
    • Source maps improvements (#1211)
    • Performance improvements in long property access evaluation (#1213)

    v5.14.1

    • keep_numbers option added to TypeScript defs (#1208)
    • Fixed parsing of nested template strings (#1204)

    v5.14.0

    • Switched to @​jridgewell/source-map for sourcemap generation (#1190, #1181)
    • Fixed source maps with non-terminated segments (#1106)
    • Enabled typescript types to be imported from the package (#1194)
    • Extra DOM props have been added (#1191)
    • Delete the AST while generating code, as a means to save RAM

    v5.13.1

    • Removed self-assignments (varname=varname) (closes #1081)
    • Separated inlining code (for inlining things into references, or removing IIFEs)
    • Allow multiple identifiers with the same name in var destructuring (eg var { a, a } = x) (#1176)

    v5.13.0

    • All calls to eval() were removed (#1171, #1184)
    • source-map was updated to 0.8.0-beta.0 (#1164)
    • NavigatorUAData was added to domprops to avoid property mangling (#1166)
    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

  • Patch os/exec

    Patch os/exec

    Patching os/exec of the go standard library would allow go build to work normally (avoiding the current buildhelper hack) and would support more programs.

A simple and super power logger for golang
A simple and super power logger for golang

The most powerfull and faster logger for golang powered by DC ?? What is this? W

Oct 18, 2022
Cloudinsight Agent is a system tool that monitors system processes and services, and sends information back to your Cloudinsight account.

Cloudinsight Agent 中文版 README Cloudinsight Agent is written in Go for collecting metrics from the system it's running on, or from other services, and

Nov 3, 2022
Log-structured virtual disk in Ceph
Log-structured virtual disk in Ceph

lsd_ceph Log-structured virtual disk in Ceph 1. Vision and Goals of the Project Implement the basic librbd API to work with the research block device

Dec 13, 2021
System resource usage profiler tool which regularly takes snapshots of the memory and CPU load of one or more running processes so as to dynamically build up a profile of their usage of system resources.
System resource usage profiler tool which regularly takes snapshots of the memory and CPU load of one or more running processes so as to dynamically build up a profile of their usage of system resources.

Vegeta is a system resource usage tracking tool built to regularly take snapshots of the memory and CPU load of one or more running processes, so as to dynamically build up a profile of their usage of system resources.

Jan 16, 2022
EdgeLog is a lightweight log management system, and Agent is a part of EdgeLog system

EdgeLog is a lightweight log management system, and Agent is a part of EdgeLog system. It is installed on host machine and its main duty is to collect host program log statics.

Oct 10, 2022
Parse awesome-go README file and generate a new README file with repo info.

Awesome Go Extra All data are from awesome-go and GitHub API. Audio and Music Libraries for manipulating audio. Name Description Star Open Issues Crea

Aug 11, 2022
A tool to list and diagnose Go processes currently running on your system

gops gops is a command to list and diagnose Go processes currently running on your system. $ gops 983 980 uplink-soecks go1.9 /usr/local/bin/u

Dec 27, 2022
Cloudprober is a monitoring software that makes it super-easy to monitor availability and performance of various components of your system.

Cloudprober is a monitoring software that makes it super-easy to monitor availability and performance of various components of your system. Cloudprobe

Dec 30, 2022
With this package you can create your own syslog server with your own handlers for different kind of syslog messages

Using this library you can easy implement your own syslog server that: Can listen on multiple UDP ports and unix domain sockets. Can pass parsed syslo

Nov 9, 2022
The Prometheus monitoring system and time series database.

Prometheus Visit prometheus.io for the full documentation, examples and guides. Prometheus, a Cloud Native Computing Foundation project, is a systems

Dec 31, 2022