vscode-go
vscode-go copied to clipboard
mode debug can't set binary path
launch.sjon
{
"name": "XDLMSrv-Debug",
"type": "go",
"request": "launch",
"mode": "debug",
"program": ".", // main.go
"buildFlags": "-o .vs/debug.exe", // if set this path, the debugger won't launch
"env": { "_DEBUG": "true"}
},
if not set, the windows firewall will always show the information of allow or deny the debugger program
Are you seeing any error messages when trying to launch the debugger?
If you haven't seen it already, here's our documentation about launch configurations for debugging: https://github.com/golang/vscode-go/blob/master/docs/debugging.md
Specific launch.json attributes are listed here: https://github.com/golang/vscode-go/blob/master/docs/debugging.md#launchjson-attributes
❓ Problem Summary:
When using "mode": "debug" in your launch.json for Go in VSCode, the debugger (Delve) compiles a temporary executable like debug_bin_xxxx.exe every time. On Windows:
- This file changes name every time (due to randomness).
- Windows Firewall prompts you each time for permission.
- Specifying
buildFlagsdoes not control the output binary name. - It's annoying and can block debugging.