Go chapters

Chapter 2 of 17

Setting up Go

Try this in our Go Compiler →

Tools you need

To write and run Go you need three things: a place to write code (any text editor such as VS Code works), a way to run the code (an interpreter or compiler for Go), and a terminal where you can type commands. Most modern editors bundle a terminal so you only need to install one program.

Your first file

Create a file named hello.go and paste in the snippet below. Save the file, then run it from your terminal. If you see the words "Hello, World!" printed back, your installation is correct and you are ready to learn the rest of the language.

```go
package main

import "fmt"

func main() { fmt.Println("Hello, World!") } ```

Common installation issues

If the command is not recognised, the language is not on your system PATH. Reinstall and tick "add to PATH" if the option is offered. On a school or work machine where you cannot install software, use any online playground — the code in this course runs unchanged in a browser-based editor.

Try it yourself

Go Compiler
Output
Code runs on the Play with Coding execution engine — your code is saved locally for next time.