{
"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)
Here are the steps to debug a revel framework (golang) app in vscode.
{ "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.