Debugging go app in Jetbrains Goland on m1

First download a proper version of GoLand here — select .dmg (MacOS Apple Silicon) here (direct link — https://www.jetbrains.com/go/download/download-thanks.html?type=eap&platform=macM1&build=211.6556.11&code=GO).
Then make sure you are using arm version of go (go version go1.16.2 darwin/arm64). If not, download and install arm version of golang (like «go1.16.2.darwin-arm64.pkg») from the list here — https://golang.org/dl/.

Now it should work.
With amd64 version of either GoLand, golang, or both, it will run as expected, but it will fail to debug in GoLand.

Further reading — https://youtrack.jetbrains.com/issue/GO-10235

If you see an error like this

# runtime/cgo
ld: framework not found CoreFoundation
clang: error: linker command failed with exit code 1 (use -v to see invocation)

You need to reinstall xcode:

sudo mv /Library/Developer/CommandLineTools /Library/Developer/CommandLineTools_old # if you are paranoid like me
sudo rm -rf /Library/Developer/CommandLineTools # otherwise
sudo xcode-select --install

Discussed on stackoverflow — https://stackoverflow.com/a/70257810/801426

LEAVE A COMMENT