本文摘自网络,作者,侵删。
- 在项目根目录下创建.vscode/launch.json
- 输入类似配置保存
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceRoot}/main.go",
"buildFlags":"-mod=vendor", // 使用vendor模式
"env": {"xxxEnv":"on"}, // 环境变量
"args": ["-config","xxx.toml"] // 启动参数
}
]
}
本文来自:简书
感谢作者:凯文不上班
查看原文:vscode golang debug配置
相关阅读 >>
更多相关阅读请进入《Go》频道 >>

Go语言101
一个与时俱进的Go编程知识库。