{
"version": "0.2.0",
"configurations": [
{
"name": "Launch",
"type": "go",
"request": "attach",
"mode": "debug",
"remotePath": "",
"port": 2345,
"host": "127.0.0.1",
"program": "revel.exe",
"env": {},
"args": [],
"showLog": true
},
]
}
如何在visual studio代码(vscode)中调试revel框架(golang)应用程序 如何编写配置文件(launch.json)
答案 0 :(得分:0)
以下是在vscode中调试Revel框架(golang)应用的步骤。
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch",
"type": "go",
"request": "launch",
"remotePath": "",
"port": 2345,
"host": "127.0.0.1",
"mode": "debug",
"program": "${workspaceRoot}/app/tmp/",
"env": {},
"args": ["-importPath", "<project folder name>", "-srcPath", "C:\\Users\\<username>\\go\\src", "-runMode", "dev"]
}
]
}
请注意-importPath应该是目录(相对于项目所在的$ GOPATH \ src)
请注意,-srcPath的值应与$ GOPATH \ src目录匹配(我在Windows上运行)
一旦这样设置了launch.json,就可以以deb模式启动该应用,并在任意位置放置断点。