How to debug on VSCode


#1

I’m trying to debug on vscode but with no success. I´ve installed Delve but when i try i receive the following error:

image

My current config for debugging is:

{
    // 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": "debug",
            "remotePath": "",
            "port": 2345,
            "host": "127.0.0.1",
            "program": "${fileDirname}",
            "env": {},
            "args": [],
            "showLog": true
        }
    ]
}

#2

It’s my config…

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch",
            "type": "go",
            "request": "launch",
            "mode": "debug",
            "remotePath": "",
            "port": 2345,
            "host": "127.0.0.1",
            "program": "${workspaceRoot}/server.go",
            "env": {},
            "args": [],
            "showLog": true,
            "buildFlags": ["-v"]
        }
	]
}

I added “buildFlags”: ["-v"]


#3

Thanks for sharing but i’ve tried your config and i’m receiving the same error and debugger doesn’t stop on breakpoint. Any tip to try something different?