
Setup your workspace The GOPATH and PATH environment variables When installed, run go version to see the installed version of Go. You can follow the official instructions on how to install Go, or you can use Homebrew instead: brew install go Exit the debugger by clicking Continue on the debugger bar or hit F5.Go is an open source programming language that makes it easy to build simple, reliable, and efficient software. Then Hover over the variable name on line 7 to see its value. Or use keyboard shortcut (Ctrl+Shift+D).Ĭlick Run and Debug, or hit F5 to run the debugger. Or place your cursor on line 7 and hit F9.īring up the Debug view by clicking on the debug icon in the Activity Bar on the side of Visual Studio Code. Open a terminal, Terminal > New Terminal, then run the command go mod init sample-app to initialize your sample Go app.Ĭopy the following code into the main.go file.Ĭreate a break point on line 7 by left clicking to the left of the numbered line. To open the folder, click the Explorer icon in the Activity Bar then click Open Folder.Ĭlick New Folder in the Explorer panel, then Create the root director for your sample Go application named sample-appĬlick New File in the Explorer panel, then name the file main.go In Visual Studio Code, open the folder where you'll create the root directory of your Go application. Wait for the Go tools to finish updating.ĥ. When prompted, select all the available Go tools then click OK. Search for Go: Install/Update tools then run the command from the pallet Or use the keyboard shortcut (Ctrl+Shift+P) In Visual Studio Code, open Command Palette's Help > Show All Commands. Search for the Go extension, then select install. In Visual Studio Code, bring up the Extensions view by clicking on the Extensions icon in the Activity Bar.

Download the version for your operating system, supports Windows, Linux, and macOS.Open a command prompt, then run go version to confirm Go was installed.įollow these steps to install Visual Studio Code:.Download the version for your operating system.


Visual Studio Code and the Go extension provide IntelliSense, code navigation, and advanced debugging. This makes Visual Studio Code the most popular editor for Go developers. In the Go Developer Survey 2020 Results, 41% of respondents chose Visual Studio Code as their most preferred editor for Go. In this quickstart, you'll install and configure the Go for Visual Studio Code extension.
