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)
source to share
Here are the steps to debug an infrastructure (golang) application in vscode.
- Import the revel project folder into vscode
- 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.
source to share