Golang Documentation

  • Installed on Macos from https://golang.org/. *.dmg file.

Check that Go is installed correctly by building a simple program, as follows. Create a file named hello.go that looks like:

package main

import "fmt"

func main() {
    fmt.Printf("hello, world\n")
}

Then build it with the go tool:

$ go build hello.go

The command above will build an executable named hello in the current directory alongside your source code. Execute it to see the greeting:

$ ./hello
hello, world