How to Install Go on Ubuntu 18.04/20.04
·
165 words
·
1 minute read
Ubuntu does come with a version of go (installable through apt install go
) but it won’t be as up-to-date as downloading it directly. And I know many gophers like using the latest version.
To begin with we’ll start by downloading the latest version and, once downloaded, we extract it into a folder we can work with (you can find the latest version here).
|
|
|
|
We then need to add some environment variables so Go knows where our work/code directory is located. GOPATH should point to the folder where you’ll be working in. This folder once setup should have your src
, bin
and pkg
folders.
|
|
Add this to the bottom:
|
|
Press :wq
to exit and run this to load your changes:
|
|
As the final test, if we run this:
|
|
We should see: go version go1.14.2 linux/amd64
Finally, some clean-up
|
|