美文网首页
vscode golang debug配置

vscode golang debug配置

作者: 凯文不上班 | 来源:发表于2021-02-03 14:21 被阅读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"] // 启动参数
            }
        ]
    }
    

    相关文章

      网友评论

          本文标题:vscode golang debug配置

          本文链接:https://www.haomeiwen.com/subject/pkaptltx.html