Golang debugger did not work on Apple Silicon (m1)

Hi,

Today I run into the problem that debugging is no longer possible in Jetbrains Goland or Visual Studio Code. The debugger starts but then stuck.

After some investigation, it turns out that this is a known problem with delve(dlv) the go debugger on Mac > BigSour 11.2 and Xcode 12.5.

The change ticket in git suggests several ways to work around the problem. The one that works at least for me was ( brew has not worked for me)

 $ git clone https://github.com/go-delve/delve
 $ cd delve
 $ go install github.com/go-delve/delve/cmd/dlv 

This will download and install the latest version of delve into your gopath. If you work on the command line referencing the new binary will work.

Run the following to figure out the location of the dlv binary

  ls $GOPATH/bin/dlv 

To make it working inside Jetbrains Goland you have to do the following steps

Open help -> Edit Custom Properties, the idea.poperties will be open in the editor

add dlv.path= and the output of the command above e.g

dlv.path=/Users/justme/go/bin/dlv

save the file and restart the Goland.

Now you will be able again to run the Debugger

Leave a Comment

Your email address will not be published.