Go on Ubuntu

Go also known as golang, is a programming language developed at Google. It is a statically typed language with syntax loosely derived from that of C, Go feature an automatic memory management and type safety. You can learn more about Go from Wikipedia.

We will be installing Go using Gophers PPA. This PPA will install the latest stable version of Go available for Ubuntu.

Installing

Adding the PPA.

sudo add-apt-repository ppa:gophers/go

Updating local repository database.

sudo apt-get update

Installing Go.

sudo apt-get install glang-stable

Writing you first Go program.

  • Create a file named ‘app.go’. Go uses .go as extension to identify a Go language file.
  • Use your favorite editor to open the file ‘app.go’.
  • Add the lines given below to the file.
package main import "fmt" func main() { fmt.Printf("Hello, 世界\n") }

Save the changes you have made in the file.

Now execute the programming by entering the command below.

go run app.go

We now have Go language compiler installed on Ubuntu. If you have any problem feel free to leave a comment below.

Leave a Reply

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