vscode调试golang程序的launch.json

记录备忘,包括调试整个工程、调试main.go、调试当前文件三种情况,可能满足绝大多数调试场景的需要。

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch Package",
            "type": "go",
            "request": "launch",
            "mode": "auto",
            "program": "${workspaceFolder}",
            "env": {},
            "args": [],
            "showLog": true
        },
        {
            "name": "Launch main.go",
            "type": "go",
            "request": "launch",
            "mode": "debug",
            "program": "${workspaceFolder}/main.go",
            "env": {},
            "args": [],
            "showLog": true
        },
        {
            "name": "Debug Current File",
            "type": "go",
            "request": "launch",
            "mode": "debug",
            "program": "${file}",
            "env": {},
            "args": [],
            "showLog": true
        }
    ]
}

 

posted @ 2025-03-24 18:58  黑月教主  阅读(306)  评论(0)    收藏  举报