Search code examples
godelve

How to run the binary with Delve in another folder?


I want to run Delve in my terminal but I fail to use the correct arguments. It worked a few weeks ago, but I forgot to document the command line.

In VS Code I can run the debugger via:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch",
            "type": "go",
            "request": "launch",
            "cwd": "run/workdir",
            "mode": "auto",
            "program": "src",
            "output": "run/workdir/myservicebin"
        }
    ]
}

The go.mod/source code is in the src folder. In run/workdir are some setting files for local development. So I want the compiled binary to be run inside run/workdir folder.

I tried:

cd src
dlv debug --wd ../run/workdir .

How to get it running?


Solution

  • I mixed up the arguments. I need to use --output ../run/workdir instead of --wd.