Welcome to Go language setup for Visual Studio Code on Windows, we are going to set up our development environment so we can code and work on go lang code on our computers easily, Let’s dive into it.
Installing Go
We must first download and install go to set up our environment. Go to the following website to download the executable for windows.
Once you navigate to Go’s download page you should select the appropriate windows installer for you. It looks something like this:
Once you click it, it will download a file similar to the following:
go1.16.5.windows-amd64.msi
I’m downloading go 1.16 for a 64 bit Windows machine. This will differ slightly depending on when you’re reading this and what your windows version is.
Simply run it and click through the executable. Once it is installed you can verify it’s installed by running this command on a cmd prompt.
go version
As well, the output will depend on the go version you installed and your windows version but it will look similar to this:
go version go1.16.5 windows/amd64
Once you get this message then congratulations! You’ve successfully installed go. You can begin coding go with powershell and a notepad or you can chose an ide such as Visual Studio Code. Following this idea, we will install Visual Studio Code.
Installing Visual Studio Code and setting up for Go development
So now that we’ve installed go we can start setting up the IDE for our development.
Visual Studio Code
You can download Visual Studio Code from the following link:
https://code.visualstudio.com/download
Again you should pick the windows version that matches your environment, but in general, the download page looks something similar to the following:
As a general rule of thumb.
- User Installer: installs only for the current user
- System Installer: installs for all users of the system
- .zip: is the files without the installer
The downloaded file looks something like:
VSCodeSetup-x64-1.58.0.exe
I recommend the system installer but that’s ultimately up to you and what you’re installing VS code on. Once you download the file run through the installation steps.
Once installed you can search for the app under the name, Visual Studio Code. As well you can open it from a cmd prompt using the following command:
code
Now that you have Visual Studio Code installed we can move on setting it up for our Go development.
Go development setup in VS Code
We must first go to our package manager noted by the symbol noted below.
Then we can search for the GO package by simply typing go in search.
We are looking for the “Go” package authored by “Go Team at Google”.
Once you’ve located this package simply press install and let VS code install it. If VS code prompts to install tools for Go then accept and let vs code setup thing necessary for you.
Wrap-up
We’ve set up a simple Go language environment for Visual Studio Code on WIndows. You can also start looking at a simple introduction by following our building and running tutorial https://exploitbrokers/programming/golang/golang-how-to-build-and-run-golang-apps/
Happy Golang Coding!