Today we will be setting the environment for needed to run golang code on your machine
Installation
Download go runtime from the main site
Remove the old go runtime(If you have go already installed)
$ rm -rf /usr/local/go
- Unzip the download file into
/usr/local/
with the following command
$ tar -C /usr/local -xzf go1.19.3.linux-amd64.tar.gz
Setup GOPATH
- Add
GOPATH
to thePATHS
by editing the shell source file
export PATH=PATH:/usr/local/go/bin
Note: The shell source file is like
.bashrc
,.zshrc
, It depends on the current running shell on your machine
Afterward to update the changes run
$ source SHELL_FILE
Now everything is set up the following command should work.
Note: that the output version might differ on your machine.
$ go version
go version go1.19.2 linux/amd64
That’s all for this article, Wish it was helpful.
If you have any questions or got stuck with some problems leave in the comments below or message me.