Teten Nugraha



Setup vscode for Golang debugging

Setup vscode for Golang debugging

Teten Nugraha's photo
Teten Nugraha
ยทAug 28, 2020ยท

1 min read

Photo by Markus Winkler on Unsplash

This is a simple article based on my experience while learning Go Language and this is a simple things for you to can debug your Golang code using Visual Studio.

Make sure that you have installed these tools on your local :

  • Golang

  • Visual Studio

Step 1

You have installed Go Plugin to help you writing code fast on previous article

Step 2

Make a simple project to show you how to debug, like this :

Step 3

On VSCode, Open debug menu or click CTRL+Shift+D and for the first time, click launch.json and add some configurations for debugging

  "version": "0.2.0",
  "configurations": [
      "name": "Launch",
      "type": "go",
      "request": "launch",
      "mode": "debug",
      "remotePath": "",
      "port": 2345,
      "host": "",
      "program": "${fileDirname}",
      "env": {},
      "args": [],
      "showLog": true

save and then restart your vscode.

Step 4

on Debug Menu, click Launch button

and wait around 10 seconds and you can look your variable value

If it was interesting or helpful to you, please do press the ๐Ÿ‘ clap button and help others find this story too.

Share this