Hello Go world – Install and Run Go in Less Than a Minute on Ubuntu 16.04 LTS

Go is a new programming language. It’s similar to C++, but aims to be simpler, safer and tries to support parallel operations better.
Installing Go and running “Hello world” takes less than a minute. This short tutorial shows you how to do it on Ubuntu 16.04 LTS.

Install golang

$ sudo apt-get update
$ sudo apt-get -y install golang

Write your Hello World

$ mkdir hellotero/
$ cd hellotero
$ nano hellotero.go

Contents of hellotero.go:

package main
import "fmt"
func main() {
     fmt.Printf("Hello Tero!\n")
}

Compile

$ go build

Run

$ ./hellotero
Hello Tero!

Well done, you’re now running go.
Next, go ahead and read official Go documentation.
Updated: fixed typos, formatted better.

Posted in Uncategorized | Tagged , , , , , | Leave a comment

Leave a Reply

Your email address will not be published. Required fields are marked *