How to debug revel framework (golang) app in visual studio code (vscode)

{
"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) app in visual studio code (vscode) how to write config file (launch.json)

+2


source to share


1 answer


Here are the steps to debug an infrastructure (golang) application in vscode.

  1. Import the revel project folder into vscode
  2. Edit ~ / .vscode / launch.json so that it looks like this: (replace the 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 must be a directory (relative to $ GOPATH \ src where your project is located)



Please note that the value for -srcPath must match your $ GOPATH \ src directory (I'm on Windows)

Once your launch.json is set up like this, you can start your application in deb mode and set breakpoints anywhere you like.

enter image description here

0


source







All Articles