I am exploring Golang as C and C++ are the main languages being used in the company I work now. Even though I do not see a future where I have to code in Golang, I just wanted to explore the Hello World with it.
Instead of installing it as part of package manager, this time I downloaded the binaries and wanted to set the environment path containing go command file.
Download the binaries.
Go to golang download page and download the version you want for linux.
Explod the same as following:
1 | $ tar xvzf ./go1.12.6.linux-amd64.tar.gz |
Add to path variable
Add the following entry at the end of the .bashrc file under your home directory (/home/ashokma/.bashrc)
1 | export GOPATH=/home/ashokma/projects/go |
Load the configs:
Unlike other systems, in linux we can just load the startup configs using source util.
1 | $ source /home/ashokma/.bashrc |
Vola \O/ That is it! Now, when we try the go in terminal linux knows where to find it.
1 | go |