Go is a statically typed, compiled programming language designed at Google, an open-source project, hosted on a GitHub repository. It's a modern programming language architected to solve everyday engineering problems. Go is young, yet loved by many because of its simplicity and its approach to common controversial issues in other programming languages.
- It is compiled rather than interpreted for the best possible performance
- It allows running multiple processes concurrently
- It is statically typed
- It's fast
- And more
Installing Go from Golang official binary
You can install Go from its binary for FreeBSD, Linux, macOS, and Windows operating systems from Golang official download page
Installing Go on Mac OS using Home Brew
brew update
brew install golang-go
Installing Go on Linux from APT Repository
You can install Go on Linux machine using APT.
sudo apt-get update
sudo apt-get install golang
Please be aware that APT repository does not always provide the recent or current up to date version of go.
Go workspace
Go uses one workspace to manage "Go" code called $GOPATH
and it must be added to your path. $GOPATH
is a directory that houses go code in a machine. From Go version 1.8, if $GOPATH
is not set, it defaults to $HOME/go
on Unix and %USERPROFILE%/go
on Windows.
On Unix systems, you can set gopath like this.
export GOPATH=${HOME}/GoProject
There are 3 directories in $GOPATH
src
for go original source files with extension is .s, .cpkg
for compiled files whose suffix is .abin
directory is where go executable files live
$GOROOT
$GOROOT
is the path where GO is installed on the machine. By default, the path on Unix is /usr/local/go
and C:\go
on Windows.
Test your installation
Finally, it's important to verify that Go
installation was successful. We can do that by executing "go version" from your shell as follows.
$ go version
go version go1.12.4 darwin/amd64
It should output your current Go
version.