Go Getting started with Go Hello, World!

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

Place the following code into a file name hello.go:

package main

import "fmt"

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

Playground

When Go is installed correctly this program can be compiled and run like this:

go run hello.go

Output:

Hello, 世界

Once you are happy with the code it can be compiled to an executable by running:

go build hello.go

This will create an executable file appropriate for your operating system in the current directory, which you can then run with the following command:

Linux, OSX, and other Unix-like systems

./hello

Windows

hello.exe

Note: The Chinese characters are important because they demonstrate that Go strings are stored as read-only slices of bytes.



Got any Go Question?