govisual-studio-codedebugging

VSCode Go dlv debugger skipped breakpoints on Mac M4 Pro machine


I tried to debug a simple test main_test.go with the following launch profile

     {
        "name": "run-concrete-test",
        "type": "go",
        "request": "launch",
        "mode": "test",
        "program": "${workspaceFolder}/main_test.go",
        "args": [
            "-test.run",
            "^TestReverse"
        ],
        "logOutput": "dap",
        "showLog": true,
    }

The debug did not stop at the breakpoint, instead it stopped at line 1859 in testing.go. Hitting the "Continue" button allowed the debugging to complete. The test passed but VSCode did not stop at the breakpoint. Two images are attached, the first one shows the breakpoint in main_test.go; the second shows VSCode stopped in testing.go. Thank you in advance for your help.[enter image description here](https://i.sstatic.net/6b9XnzBM.png)

I started debugging and expected VSCode to stop at the breakpoint in main_test.go


Solution

  • If the debugger is stopping in gopark , then this could be an issue that was resolved in delve 1.24.2; note that this is specifically the delve version, not the Go version.

    You can check the version of delve installed using dlv version in terminal.

    In VS Code command palette, run Go Install/Update tools and select to update delve if necessary.