Go Support in VSCode

A free video tutorial from Stephen Grider
Engineering Architect
Rating: 4.6 out of 5Instructor rating
37 courses
1,424,849 students
Go Support in VSCode

Learn more from the full course

Go: The Complete Developer's Guide (Golang)

Master the fundamentals and advanced features of the Go Programming Language (Golang)

08:52:03 of on-demand video • Updated July 2024

Build massively concurrent programs with Go Routines and Channels
Learn the advanced features of Go
Understand the differences between commonly used data structures
Prove your knowledge with dozens of included quiz questions
Apply Interfaces to dramatically simplify complex programs
Use types to future-proof your code and reduce the difficulty of refactors
English [CC]
-: Now that we've installed the VSCode editor, we're going to do just a tiny bit of configuration to it to set it up to work nicely with Golang. So, outta the box VSCode doesn't have any support for Go. It's only by installing a little extension, do we kind of teach the the editor how to handle Go code. So, let's get to it. I'll open up the Visual Studio code editor, and then when I do, I'm gonna find the top nav menu up here. So, here's the top menu bar. I'll find the option "View," and then inside of there, I'll find the option "Extensions." So, here's extensions right here. Now, this sidebar that pops up lists a ton of different extensions that we can install into our code editor. A lot of these different extensions add support for different languages inside the editor, like say, Python or C Sharp, right here. Now, we wanna search for a very particular extension. We're going to enter in a search string of "Go." Now, hopefully the first result that pops up is something that says "Rich Go language support for Visual Studio," should have around one, two, 3 million downloads. And so, we'll just click the install button to install it. Now, I wish I could say that the installation process, or the configuration for Go, was that easy. Unfortunately, there's one more little step we have to do. When we install this Go language support extension right here, it's just really a bonding layer between our code editor and a set of underlying command line tools that are actually responsible for, kind of, doing some code quality checks of any open file. And so, it's extension, while fantastic, and it adds support to the language, or to our editor for us we also have to make sure that it has the ability to install these extra tools that it needs to function properly. So, to make sure that it installs these other tools, really straightforward, all we have to do is close the code editor. So, we're gonna quit Visual Studio Code entirely. I'll then start it right back up. So, I'm gonna start it right back up. And then, here's the kind of weird part, but just bear with me for a second. I'm going to make sure that I have a code editor window open. If you don't have a Code window open like this, you know one that we can actually type into, you can go up to "file," and then "new file," up here. And so, boom, I've got a Code editor window open. Now, on the bottom right hand side, you should see something down here that says "Plain Text." So, we're gonna click that. We're going to change the language mode of the editor to Go. So I'll type in "go," and I should see an option here of Go. Now, when I do that, you are gonna see this yellow text down here at the very bottom, right-hand side, something that says "Analysis Tools Missing." And so, these are the extra tools that the Go Extension needs to make sure that it can, kind of, vet your code quality inside of your editor. So, we're gonna click on this, and that it's going to prompt us to install a couple of analysis tools. So, all we have to do is click "install," and we're gonna see a terminal window pop up here, and it's going to grab a couple of different tools. And, it should just take in a second or two to finish up. So, that's pretty much it. Now, the next time that we open up a Go file inside of VSCode, we should have a bunch of tools available to help us to write code, analyze it, and just make sure we're doing things correctly. So, that's pretty much it for our code editor setup. Let's take a break, come back the next section, and we're gonna start talking about the first project that we're going to work on. So, I'll see you in just a minute.