Launch Debug from Anywhere in Visual Studio Code

Debugging should be easy, except when it’s annoying.

All cereals, no milk.
Photo by Rachael Gorjestani on Unsplash

debug failing to start in Visual code is up there on my top pet peeves with a piece of celery on your teeth, loud nachos in cinemas and pouring your favorite cereal for breakfast only to have a drop of milk left. Just enough to wet bits of your cereals. Yeeeeargh!

When chasing bugs down the rabbit hole, we may arrive at the innards of code deep in some dark unchartered modules. Satisfied that this obscure line you’ve written half asleep in the wee hours is the source of your frustrations, you click the red debug breakpoint. Then start debug. Then Nothing. Nada. Nought. Zilch. Yeeeeargh!

Visual code error, Failed to Continue.
Debug needs debugging

Naturally, your IDE has no of idea your entry point. Open up launch.json in your .vscode/ directory and modify the configuration to statically point to your main entry point, whatever that may be.

“configurations”: [
“name”: “Launch”,
“type”: “go”,
“request”: “launch”,
“mode”: “auto”,
“program”: “${workspaceRoot}/mydir/WhateverFileIWant.go”,
“env”: {},
“args”: []
Success! Debug started.
Success! Debug started

That’s it. Your debug should start from where you currently are.


Update your launch.json configuration to be able to start debug from anywhere.

Wait, did I just write a medium because I’m too damn lazy to Google this every single time? Yup. Yes I did.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store