Developer Experience
min of reading
July 1, 2020

Introduction to Golang

Morvana Bonin
Backend Software Engineer with a strong passion for design patterns, clean code and software architecture.
More about the author

* article developed in partnership with Andreia Camila da Silva

Golang or simply Go is an open source programming language created at Google in 2007 by Robert Grieserer (V8), Rob Pike and Ken Thomps (UNIX & UTF-8), but its announcement was only made in 2009 and its version 1.0 came out in 2012.

Although the language is already over 10 years old, only recently have we heard more about it, especially with its use being adopted by commonly and widely used software such as Docker and Kubernetes, developed in the language.

The Go language structure is very similar to the C language, but its learning curve is simpler. Go is a language created to make the most of computers with multi-core resources, thus facilitating the compilation of code in an efficient and naturally cooperative way with the abstractions of current operating systems.

Golang Installation

A quick note before dealing with the installation part: it is important to know that it is not necessary to have Go installed in your environment to take the first steps – it is possible to just "play" and take the first steps with the language doing a Hello World! by two different ways and learn more about the syntax of the language. They are: [a tour by Go] ( and also [Playground Go] (

Go's installation is as simple as the ease of learning the language and it is possible to do it on Linux OS, MacOS and Windows.

The stable version used for the installation and writing of this article is go1.14.4, it is possible that at the time of reading this article, the version is more up to date, so it is advisable to see the official language site in the downloads section


To complete the installation, you need to download the Go binary. You can use the curl or wget commands.

curl -O

Check the .tar using sha256sum

sha256sum go1.14.4.linux-amd64.tar.gz

By using the following command, extract inside the /usr/local directory to install the Go distribution

$ sudo tar -C /usr/local -xzf go1.14.4.linux-amd64.tar.gz

You need to export the go and bin file, open ~/.profile in an editor

$ sudo vim ~/.profile

Paste or write these two lines at the end of the file

export PATH=$PATH:/usr/local/go/bin

Save the file and reload it with the following command

source ~/.profile

To test the installation, simply run the command

$ go version


Download the stable and recent version of the Go binary package for MacOS. As with Linux, use the curl command

curl -o golang.pkg

To install it, just double-click the downloaded file to start the installation wizard or use the following command line

sudo open golang.pkg

When installing the package, it should already create and put the /usr/local/go/bin directory in its PATH environment variable. It may only be necessary to restart open terminal sessions for the change to take effect.Otherwise, it is necessary to follow similar steps to the one previously given in the Linux installation sessionOpen the file ~/.profile in an editor

$ vi ~/.profile

Paste or write these lines in the file

export GOROOT=/usr/local/go
export PATH=$GOROOT/bin:$PATH

GOROOT is the location where the Go package is installed on your systemAt the end, the PATH export sets the variable to access the entire binary system.To test the installation, simply run the following command

$ go version


For Windows users, two installation options are provided (in addition to installation from source): a zip file that requires you to set some environment variables, and an MSI installer that sets up your installation automatically.

For the .zip file, download the file at, then extract the content to the directory of your choice (the suggestion given by the documentation is c:\Go)

Remember that you need to add the bin subdirectory of your Go root (e.g. c:\Go\bin) to your PATH environment variable.

Now using the MSI file, open it and follow the instructions to install the tools. By default, the installer puts the Go distribution in c:\Go.

Unlike the installation by using the zip file, the installer should put the directory c:\Go\bin in its PATH environment variable. It may only be necessary to restart any open command prompt for the change to take effect.


Another alternative to install and manage Go versions is [gvm]( run the command below to install the gvm-installerbash <<(curl -s -S -L install the desired version of Go, using

gvm install go1.14
gvm use go1.14

It's worth knowing that some versions of Go have some slightly different configurations, for example, the older versions use GOPATH to set the working directory. From go1.11 onwards, this is no longer so common and, for go1.14, it is already considered deprecated.

Hello World!

Testing the installation

Let's go to the traditional Hello World. With Go language, what has been transcribed here comes mostly from the documentation of the language itself.

Create an aprendendo_go directory and create a file called hello.go inside it. In the file, write these code lines and save it

package main
import "fmt"
func main() {fmt.Printf("hello world\n")

Then build it by running the following command in a terminal inside the aprendendo_go directory

$ go build hello.go

The above command will create an executable called hello in the aprendendo_go directory next to its source code. Run it by running the following command to see the greeting:

$ ./hello
hello world

It is worth mentioning that there are already several plugins (some of them maintained by the Go community itself) of editors and IDEs to make development more productive. Here is the link for some of them:

This was the first post about Go, which will be a part of a sequence of Posts that Andreia Camila da Silva and I will do giving an introduction about the language.MacOS and Windows environments have not been previously tested. If there is any inconsistency, you can contact the authors for adjustments or even for knowledge exchange. You’re always welcome.

References and useful links

Language website

Applications developed in Go

Practical introduction to Go using annotated example programs

Russ Cox joined the team and made great contributions, his blog is very rich in content

Learn Go from Zero

Golang in 20 minutes by Wesley WilliansThe Go Programming Language por Alan A. A. Donovan and Brian W. Kernighan

Thanks for reading!