how to debug revel framework(golang) application i

2019-07-11 18:21发布

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

]

}

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

标签: revel
1条回答
别忘想泡老子
2楼-- · 2019-07-11 18:53

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

  1. Import revel project folder into vscode
  2. Edit ~/.vscode/launch.json so that it looks like the following: (replace values in <> with values for your own local env.

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

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

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

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

enter image description here

查看更多
登录 后发表回答