Essential Go Getting started  Suggest an edit

Hello, World!

Create a file hello_world.go:

package main

import "fmt"

func main() {
	fmt.Println("Hello, 世界")
}
Hello, 世界

Run it with go run hello_world.go.

go run is useful for ad-hoc execution of single-file program.

You can also create an executable with go build hello_world.go.

On Windows this will create .\hello_world.exe executable.

On every other OS this will create ./hello_world executable.

  ↑ ↓ to navigate     ↵ to select     Esc to close