I'm trying to debug my program in VSCode. My Launch.json file looks as follows:
{
// 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": [
{
"name": "Launch Package",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/DS_PA1/srunner/",
"cwd" : "${workspaceFolder}/DS_PA1/srunner/"
}
]
}
My folder hierarchy is:
The debugger is set in the function main():
On launching, it starts the server and without stopping at the breakpoint it just printed the statement "Started KeyValueServer..."
Any pointers as to how I can make it stop at func main() so that I can debug manually?
Related
My launch.json:
{
// 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": [
{
"name": "Launch test function",
"type": "go",
"request": "launch",
"mode": "test",
"program": "${workspaceFolder}/checkers/x/checkers/keeper",
"args": [
],
"env": {"GOPATH":"/home/alain/go", "PATH":"/home/alain/go/bin", "GO15VENDOREXPERIMENT": 1}
}
]
}
The dlv binary is in /home/alain/go/bin and works perfectly. Even outside of that directory it works.
However, when trying to launch debuggin in vscode, I am still getting the error:
Failed to continue "Cannot find delve debugger. Install from https://github.com/go-delve/delve & ensure it is in your Go tools path, "GOPATH/bin" or "PATH"
For reference: I did install delve from https://github.com/go-delve/delve
I want to debug a Jupiter notebook in VSCode, that access multiple other .py scripts with class methods. I've set a breaking point in the respective cell, but the debugger keeps running infinitely and I got no results neither in variables section nor in call stack section and my debug console just remains empty.
I would be grateful if there is any idea why the debugger is stuck.
This is what I have in my launch.json:
// 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": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
},
{
"name": "Debug Unit Test",
"type": "python",
"request": "launch", //launch or attach
"justMyCode": false,
}
]
}
VSCode Info:
Version: 1.64.2 (Universal)
Commit: f80445acd5a3dadef24aa209168452a3d97cc326
Date: 2022-02-09T22:00:58.347Z
Electron: 13.5.2
Chromium: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Darwin arm64 20.6.0
I'm trying to debug my goland app and have some problems with launch.json file. My app should be run with argument: my_go_app -c path_to_config.
My launch.json looks like:
{
// 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": [
{
"name": "Launch my go app",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${fileDirname}",
"args": ["-c /home/roman/projects/myapp/some.json"]
}
]
}
But when I debug app I have received the following error:
flag provided but not defined: -c /home/roman/projects/myapp/some.json
Usage of /tmp/__debug_bin542579318:
-c string
Specify the configuration file. (default "config.json")
Without debugging my app runs with success. Please explain what is wrong...
I have found where is problem. The json should be like this:
{
// 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": [
{
"name": "Launch my go app",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${fileDirname}",
"args": ["-c", "/home/roman/projects/myapp/some.json"]
}
]
}
I have installed the following task to compile my Go project following this blog post: https://robertbasic.com/blog/build-and-run-golang-projects-in-vs-code/
tasks.json:
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Build Go",
"type": "shell",
"command": "go build",
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
Now I can compile the project using Terminal>Run build task
For running and debugging, I have created:
launch.json:
{
// 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": [
{
"name": "Launch",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${fileDirname}",
"cwd": "${workspaceRoot}",
"args": [],
"env": {}
}
]
}
But it does not work, I get the following message:
package .: no Go files in /usr/home/username/projects/my_app/.vscode
Process exiting with code: 1 signal: false
Visual Studio Code under FreeBSD12.1 (probably not relevant).
What do I have to do to get the program running when using F5/CTRL+F5?
Any tip including recommended help section or blog entry is welcomed.
Assuming my main package is at the root folder of the workspace, I always define the same .vscode/launch.json:
{
// 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": [
{
"name": "Launch",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}",
"env": {},
"args": []
}
]
}
From there, I can press F5 from anywhere/any file, and the debug session simply starts.
My debugger works just in one file now (test.js) When I try to debug in another file still debug the test.js Anybody know the solution for this problem please?
{
// 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": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}\\test.js"
}
]
}
use Debugger for chrome extension in visual studio .