Tips for debugging Go in an IDE

I’ve been using this method in Ubuntu 15.04 for about 4 weeks. It’s early days and by far an ideal solution. However, it has worked really well for me…

The latest build of the Go plugin for IntelliJ now incorporates the Delve package. If you don’t have a JetBrains IDE you can download the free Community Edition of IntelliJ.

Install the Go plugin by first adding the pre-release repository. Inside the editor you’ll see you can now create breakpoints in Go projects by clicking on the left gutter of the editor.

After setting a breakpoint create a run/debug configuration. The lazy way to create a configuration is to right click in the editor and choose Debug from the context menu. The default configuration will probably not work first time. To fix edit the run/debug configuration and ensure the Name field contains a simple name without spaces or periods. Also set the Output Directory local to the project. I also set the Working Directory so that relative paths to assets in web applications can work.

There is a bit more information about debugging a Go project in the Go plugin wiki.

Do you have any tips for interactively debugger Go in Linux, Mac or Windows? Please share your experiences below.

7 Likes

I was able to debug Go programs (mainly tests) in Emacs using delve and https://github.com/benma/go-dlv.el. It is usable at least for small programs.

This doesn’t seem to be the correct category for such a post. Can it be re-categorized to the correct topic section of the forum?

1 Like

What category would you suggest?

I would say that the Technical Discussions category is a better fit for your post. The Releases category is supposed to be for announcing new Go projects and packages.

I thought being about the Delve package the original choice was best. Your suggestion makes sense, so it’s been changed.

I have no interest in starting a holy war here, so I’ll say for those that use vim, here’s the plugin’s I use for a psudo-IDK like experience are:

4 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.