If you want to install Go on your Raspberry Pi you have a few options. In the past there was a lot of cross compiling and hacking to get it done, but now you can install it through Apt. However, you’re likely to find an older version.
For instance at the time of this writing, an updated Raspberry Pi OS shows a version of 1.11.1 in the repositories. However the current version is 1.14.3 so if the latest version is important to you, here’s your solution.
Step 1: Get the Latest Package
To get the latest version, browse on over to the Go download page and look for the latest version.
Look for the “ARM v6 version” for the Raspberry Pi.
My current archive is https://dl.google.com/go/go1.14.4.linux-armv6l.tar.gz
Whichever archive you choose, use wget to download it:
mkdir ~/src && cd ~/src wget https://dl.google.com/go/go1.14.4.linux-armv6l.tar.gz
Now you have the latest package.
Step 2: Extract the Package
Now you’ll want to extract the package into your local folder:
sudo tar -C /usr/local -xzf go1.14.4.linux-armv6l.tar.gz rm go1.14.4.linux-arm64.tar.gz
Step 3: Configure Go
Now you just need to configure it, which you have to do with any Go installation anyway.
Open up your ~/.profile (Using nano, vi, etc)
and add the following:
Notice here you can set your go path to whatever you like. I prefer /go, but you can put this wherever you want.
Update your shell with your changes:
And check your version:
And you’re good to Go!
Get it? Yeah I’ll show myself out.
Learn how to leverage the Standard Library like a PRO. I just created a new course, The Go Standard Library, check it out!