Loading…

Online Go Compiler and Playground

Browser-based compiler and playground for Go — Progsity IDE.

About Go

Go was built at Google for cloud services and CLIs: fast compile times, static binaries, and first-class concurrency with goroutines. This Go playground runs a standard package main with func main() so you can learn fmt, slices, and goroutines without GOPATH setup on your machine.

The toolchains emphasis on simplicity makes Go popular for DevOps tooling and APIs. Here you can benchmark small ideas: parsing, JSON, and channel patterns in isolation.

Stdin works well with bufio for competitive-style input. Save snippets when signed in to keep templates for contests.

How to use

  1. Keep package main and func main(). Import packages with double quotes, e.g. "fmt".
  2. Use bufio.NewScanner(os.Stdin) for line input; paste stdin in the panel.
  3. Read compile errors—often unused imports or wrong package name—then Run again.

FAQ

Is Go free to run?

Yes. Execution is free; snippet storage follows account limits.

Which Go version?

A recent stable Go toolchain in the sandbox. Print runtime.Version() if you need to verify.

Can I use go modules?

The playground focuses on standard library snippets. Arbitrary module downloads are not the goal in Phase 1.

Save Go code?

Yes after sign-in via Dashboard.

Compiler or playground?

Go compiles quickly; you still get edit-run feedback like a playground for learning.

Code examples

Tap “Try this” to load sample code into the editor above.

  • fmt.Println

    package main
    
    import "fmt"
    
    func main() {
    	fmt.Println("Hello", "from", "Go")
    }
  • Slice sum

    package main
    
    import "fmt"
    
    func main() {
    	xs := []int{2, 3, 5, 7}
    	s := 0
    	for _, v := range xs {
    		s += v
    	}
    	fmt.Println(s)
    }
  • Map count

    package main
    
    import "fmt"
    
    func main() {
    	m := map[string]int{"a": 1, "b": 2}
    	fmt.Println(len(m))
    }
  • Scanner stdin

    package main
    
    import (
    	"bufio"
    	"fmt"
    	"os"
    	"strconv"
    	"strings"
    )
    
    func main() {
    	sc := bufio.NewScanner(os.Stdin)
    	sc.Scan()
    	parts := strings.Fields(sc.Text())
    	a, _ := strconv.Atoi(parts[0])
    	b, _ := strconv.Atoi(parts[1])
    	fmt.Println(a + b)
    }