1
0
mirror of https://github.com/lxc/incus.git synced 2026-02-05 09:46:19 +01:00

vscode: Add VSCode launch.json for incusd "Run and Debug" functionality

The Visual Studio Code editor has the ability to attach to or launch golang
binaries for interactive debugging, with variable inspection and breakpoints

The launch.json file adds the following menu entries to the "Run and Debug"
menu in VS Code

- Attach to Incusd
- Launch Incusd
- Launch Incusd --debug

The first menu will allow the user to select a running incusd instance to
attach the VS Code Go Delve debugger to.

The other two options will launch the most recently built incusd, with
or without the --debug option, allowing live debugging in the editor with breakpoints

Assuming incusd is built into the ~/go/bin directory.

Signed-off-by: Stuart Espey <stuart.espey@mactrix.com>
This commit is contained in:
Stuart Espey
2025-05-29 03:34:54 +00:00
parent b38eb16a41
commit 872c5d75ac

57
.vscode/launch.json vendored Normal file
View File

@@ -0,0 +1,57 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
// if the incusd is running, this will attach to it.
"name": "Attach to Incusd",
"type": "go",
"request": "attach",
"mode": "local",
"processId": "incusd",
"asRoot":true,
"console": "integratedTerminal"
},
{
// after running `make` to install incusd, assuming that your go/bin is in your home directory, this should launch incusd if its not a service.
// if it is an active service, you actually need to restart the service, and then attach to it.
"name": "Launch Incusd",
"type":"go",
"request": "launch",
"mode": "exec",
"asRoot": true,
"program": "${userHome}/go/bin/incusd",
"env": {
"PATH": "${env:PATH}:${userHome}/go/bin/",
"LD_LIBRARY_PATH": "${userHome}/go/deps/raft/.libs/:${userHome}/go/deps/cowsql/.libs/"
},
"args": [
"--group",
"sudo"
],
"console": "integratedTerminal",
},
{
"name": "Launch Incusd --debug",
"type":"go",
"request": "launch",
"mode": "exec",
"asRoot": true,
"program": "${userHome}/go/bin/incusd",
"env": {
"PATH": "${env:PATH}:${userHome}/go/bin/",
"LD_LIBRARY_PATH": "${userHome}/go/deps/raft/.libs/:${userHome}/go/deps/cowsql/.libs/"
},
"args": [
"--group",
"sudo",
"--debug"
],
"console": "integratedTerminal",
}
]
}