如何在Visual Studio代码(vscode)中调试Revel Framework(golang)应用程序 [英] how to debug revel framework(golang) application in visual studio code(vscode)

查看:240
本文介绍了如何在Visual Studio代码(vscode)中调试Revel Framework(golang)应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

{
"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)

how to debug revel framework(golang) application in visual studio code(vscode) how to write the configuration file(launch.json)

推荐答案

以下是在vscode中调试Revel框架(golang)应用的步骤.

Here are the steps to debug a revel framework (golang) app in vscode.

  1. 将revel项目文件夹导入vscode
  2. 编辑〜/.vscode/launch.json,使其类似于以下内容:(将<>中的值替换为您自己的本地环境的值.

{ "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"] } ] }

{ "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)

Note that -importPath should be the directory (relative to $GOPATH\src where your project lives)

请注意,-srcPath的值应与$ GOPATH \ src目录匹配(我在Windows上运行)

Note that the value for -srcPath should match your $GOPATH\src directory (I'm running on Windows)

一旦这样设置了launch.json,就可以以deb模式启动该应用,并在任意位置放置断点.

Once your launch.json is set up as so, you can start the app in deb mode and put breakpoints wherever you wish.

这篇关于如何在Visual Studio代码(vscode)中调试Revel Framework(golang)应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆