Debug Adapter Of VScode

aisuko

Aisuko

Posted on April 24, 2021

Debug Adapter Of VScode

The story comes from the issue:

https://github.com/golang/vscode-go/issues/1450

IF you are a Golang developer, you should know how to debug the Golang code. And we know that there many IDE or Editor we can use, some like:

  • Goland
  • Vscode
  • Some people use Emacs, I guessed

But Goland is not free, except you are an open-source engineer and keeping active on the project which you contributed all time. And you can apply for the open-source License.

I'd like to say thanks to Jetbrains

So, if we use Vscode in order to debug our code, may need to pay more attention some issue from the language extensions.

As you can saw from the issue that some issues with the debug adapter.

Finally

If you debug Golang with Vscode, you should care about some issues.

I personally like both of them I mentioned above. And I'd like to help Vscode Golang debug adapter better.

Tip

There a tip I'd like to share with more people

When we want to use Vscode run the test functions like below

Alt Text

We should not like the debug test which locate on the function name. So, how should we do?

  • Creating a debug configuration
{
    // 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": "Test",
            "type": "go",
            "request": "launch",
            "mode": "test",
            // <Should be replace:The folder includes the test files like `xxx_test.go`>
            "program": "${workspaceFolder}/pkg/teams",
            "debugAdapter": "dlv-dap",
            "showLog": true,
            "logOutput": "dap",
            "trace": "verbose"
        }
    ]
}
Enter fullscreen mode Exit fullscreen mode

And open the file location where you want to run(your cursor on the test method is good), tap shift+command+p MacOS, input Debug Test At Cursor, the Vscode would run the test methods which at your cursor, this is useful.

💖 💪 🙅 🚩
aisuko
Aisuko

Posted on April 24, 2021

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

Debug Adapter Of VScode
vscode Debug Adapter Of VScode

April 24, 2021