Hello World in Go


source code

package main

import "fmt"

func main() {

To run the program

Go is a compiled language. The Go toolchain converts a source program and the things it depends on into instructions in the native machine language of a computer.

use go run
go run helloworld.go
Go natively handles Unicode, so it can process text in all the world’s languages.

using go build

If the program is more than a one-shot experiment, it’s likely that you would want to compile it once and save the compiled result for later use. That is done with go build:

use go build
go build helloworld.go

Related Tags