Setting Up a Go VSCode Development Environment
VSCode has rich support for the Go language and Microsoft is an avid supporter. The extensions are absolutely phenomenal and even allow inline testing of unit tests in the source code itself. Here’s how to get started coding Go in VSCode.
But First …
Step by Step
When installing Go on Linux there is an important initial decision to be made:
Do I use the package manager or do I download the tar ball?
Here are some things to consider:
- Do you want or need the latest stable release?
- How likely are you to upgrade later?
- How good are your skills are using [
If you are comfortable with
tar the answer should probably be download the latest and untar it into the proper location. This requires more skills on the command line, however. If you have doubt at all and don’t need the latest then just do the following super easy command:
sudo apt install golang
The following is only if you want to use
tar to get the latest. For the record, we are just doing what the https://golang.org web page instructs us to do.
Go to the https://golang.org/dl and find the one for Linux and click it to download. Click on Save File when prompted.
⚠️ Do not extract the tarball when prompted by your web browser when it downloads.
cd cd Downloads ls go*
You should see something like the following ending in
Now enter the following command making very sure you get it right.
sudo tar -C /usr/local -xzf go1.12.5.linux-amd64.tar.gz
Now you can verify your version with
go version go1.12 linux/amd64