Skip to main content

Go (Golang)

Go (Golang), is an open-source, statically typed, and compiled programming language developed by Google. It is designed for simplicity, efficiency, and strong support for concurrency, making it well-suited for building scalable and high-performance applications.

LiveCodes uses GopherJS which is a Go to JavaScript compiler, to run Go in the browser.

Note

LiveCodes also supports running Go using Yaegi, the Go interpreter (running on WebAssembly). Read documentation here.

Demo​

show code
import { createPlayground } from 'livecodes';

const options = {
"params": {
"go": "package main\n\nimport \"fmt\"\n\nfunc main() {\n\tfmt.Println(\"Hello, World!\")\n}\n",
"console": "full"
}
};
createPlayground('#container', options);

Usage​

LiveCodes runs Go in the browser, including the standard library.

JavaScript interoperability and DOM access is achieved using package js (see the example below).

Language Info​

Name​

go

Extensions​

go, golang

Editor​

script

Compiler​

GopherJS, the Go to JavaScript compiler.

Version​

GopherJS v1.19.0 beta1, running Go 1.19.13

Code Formatting​

Using GopherJS

Example Usage​

This example demonstrates standard library usage, JavaScript interoperability and DOM access:

show code
import { createPlayground } from 'livecodes';

const options = {
"template": "go"
};
createPlayground('#container', options);

Starter Template​

https://livecodes.io/?template=go