
MacM4 Goland 无法 Debug 调试,跳转 gopark
背景
最近把开发环境升级到了 M4 芯片的 Mac,结果 Go 项目开发时遇到了超级烦人的问题。每次用 Goland 调试代码,断点直接跳到 gopark` 函数,整个调试过程基本报废。
直接说原因吧,就是 Goland 自带的 dlv 版本太老了
解决方案
手动编译个新版 delve 替换掉 Goland 自带的版本就行:
- 首先,找到 Goland 里自带的 dlv 在哪。通常是类似这样的路径(根据你的安装路径可能会不同):
/Users/feng/Applications/GoLand.app/Contents/plugins/go-plugin/lib/dlv/macarm/
- 从 GitHub 上拉取最新的 delve 代码并构建:
1
2
3
4
5
6git clone https://github.com/go-delve/delve.git
cd delve/cmd/dlv
# 把生成的新的 dlv 复制至goland 使用的 dlv 的目录下
go build -o /Users/feng/Applications/GoLand.app/Contents/plugins/go-plugin/lib/dlv/macarm/dlv main.go - 重启 Goland 试试调试,我这边问题就解决了。
- Thanks for your appreciation. / 感谢您的赞赏
赞赏名单
Because of your support, I realize the value of writing articles. / 由于您的支持,我才能够实现写作的价值。
本文是原创文章,采用CC BY-NC-SA 4.0协议,完整转载请注明来自Go知行
评论