The Go is a programming language was created by Google it's similar to C and not an object oriented language, so a certain degree of simplicity exists . One of the advantages is a compiled type language which makes it faster than interpreted languages like Python. Also supports concurrent programming in language level through Go routines. This feature makes it very useful in networking and system level applications and also very popular in building microservices.
Let's install Go in our linux distribution, first we go to the official website https://golang.org for downloading the archive that contains the binary files, after that we unpack the archive to directory /usr/local, this directory is used to install independent software that is not managed from OS package systems, then we extract the archive with the following command.
tar -C /usr/local -xzf go1.7.4.linux-386.tar.gz
If you see any problem with permissions, run the previous as sudo user. Then, using an editor like nano we open file /etc/profile to setup the paths, that is necessary, shell to know where are the executable files to Go lang. This can be done by appending in the end of the file /etc/profile the following command
export PATH=$PATH:/usr/local/go/bin
To continue the new changes to take place we have to refresh file .profile with the following
source /etc/profile
if we write in command line the word go, now we see all related commands for compile go programs
The commands are:
build compile packages and dependencies clean remove object files doc show documentation for package or symbol env print Go environment information
To make a test let's create a new file
touch test.go
append the following code
package main func main() { println("Hello", "world") }
we compile and run the go program with go run test.go
which outputs
Hello world