Join the AI Workshop to learn more about AI and how it can be applied to web development. Next cohort February 1st, 2026
The AI-first Web Development BOOTCAMP cohort starts February 24th, 2026. 10 weeks of intensive training and hands-on projects.
VS Code has a powerful built-in debugger that works with many languages.
General Debugging
To start debugging:
- Click the Debug icon in the sidebar (or press
F5) - VS Code will prompt you to create a debug configuration if one doesn’t exist
- Set breakpoints by clicking in the gutter next to line numbers
- Start debugging
The debugger provides:
- Variables inspection (local and global)
- Watch expressions for specific variables
- Call stack visualization
- Breakpoints management
Debugging Go with Delve
For Go debugging, you need Delve.
Setup
- Install the official Go VS Code extension
- Make sure
$GOPATHis configured - On Linux/Windows: Run the command
Go: Install/Update Tools - On Mac: Install Delve via Homebrew:
brew install go-delve/delve/delve
Configuration
Press F5 to start debugging. VS Code creates a .vscode/launch.json file automatically:
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch",
"type": "go",
"request": "launch",
"mode": "debug",
"remotePath": "",
"port": 2345,
"host": "127.0.0.1",
"program": "${fileDirname}",
"env": {},
"args": [],
"showLog": true
}
]
}
Debug Modes
The mode parameter can be set to:
| Mode | Description |
|---|---|
debug | Compile and debug the current program |
test | Debug tests (use -test.run and test name in args for single tests) |
exec | Run a pre-built binary (specify path in program) |
remote | Debug remotely |
Tips
- Step into library calls to learn how the standard library works
- The Go standard library is well documented and readable
- Debugging helps you understand internal workings of packages you use
Check the official documentation for more details and troubleshooting tips.