Andrii's blog Blog about programming

Debugging Golang With Delve

How to debug golang code

Yes, the Go code can and should be debugged. I often clash in different teams, as developers, so far in 2019! debug with prints :)

Delve is the debugger that I usually use every day. If you open the documentation, it’s not perfect to say the least.

You can install it:

go get -u

Most often I use dlv debug :

dlv debug


dlv debug main.go
(dlv) breakpoint main.go:1
(dlv) continue

After you have set the breakpoint, you can click continue and the program will stop where needed, and so on. There are also shortcuts (b, c, l and so on).


comments powered by Disqus