vscode golang debug配置

内容分享2周前发布
0 0 0
  • 在项目根目录下创建.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"] // 启动参数
        }
    ]
}

© 版权声明

相关文章

暂无评论

您必须登录才能参与评论!
立即登录
none
暂无评论...