Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Ivan Jijon
Ivan Jijon

Posted on

     

How to configure Delve (dlv) in VS Code

Let's have Delve integrated with VS Code!

First you need to install Delve (dlv):

go install github.com/go-delve/delve/cmd/dlv@latest
Enter fullscreen modeExit fullscreen mode

You can verify where it was installed by running:

which dlv
Enter fullscreen modeExit fullscreen mode

Then in Visual Studio Code you need to go to Settings and search "delve". You will findGo: Delve Config.

Image description

Click on "Edit in settings.json".

Add the path to dlv you obtained before:

"go.delveConfig": {    "dlvPath":"/Users/<user>/go/bin/dlv"}
Enter fullscreen modeExit fullscreen mode

Finally, in thelaunch.json file add the configuration for launching the debugger.

Adapt "program" and "envFile" to point to the values needed in your project.

Here an example:

"configurations": [    {        "name":"Launch",        "type": "go",        "request": "launch",        "mode": "debug",        "program": "${workspaceFolder}/.../main.go",        "envFile": "${workspaceFolder}/.../.env"    }]
Enter fullscreen modeExit fullscreen mode

You can now run in debug mode your program by pressing F5 key.

I hope you will find this setup helpful.

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

Passionate about coding, addicted to learning and continuous improvement. I am always looking to strengthen both my programming and soft skills through reading technical books, online courses, ...
  • Joined

Trending onDEV CommunityHot

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp