解决goland在mac m1下无法调试问题
背景
新电脑mac m1
goland调试抛出异常
异常信息
第一次异常信息
could not launch process: can not run under Rosetta, check that the installed build of Go is right for your CPU architecture
原因是goland版本安装错了.
下载地址:https://www.jetbrains.com/zh-cn/go/download/#section=mac
.dmg选择 Apple Silicon
第二次异常信息
Cannot find the Delve executable for darwin/arm64. Specify the Delve location by adding 'dlv.path=/path/to/delve' in 'Help | Edit Custom
需要配置dlv.path,步骤如下
-
安装 darwin/arm64 版本go , 执行:brew install go ,我电脑安装最新版: go version go1.19 darwin/arm64
-
安装 Apple Silicon版本的Goland ,上面已经说过,我电脑安装的是 GoLand 2022.2.2
-
安装delve
git clone https://github.com/go-delve/delve
cd delve && make install
,- delve会安装在 ~/go/bin/dlv ,我本地:/Users/bj00195ml/go/bin/dlv
-
配置dlv,
-
打开Goland Help->Edit Custom VM Options. 添加
-Ddlv.path=/Users/bj00195ml/go/bin/dlv
。bj00195ml替换成你的 -
打开Goland Help->Edit Custom properties 添加
dlv.path=/Users/bj00195ml/go/bin/dlv
。bj00195ml替换成你的
-
- 重启Goland
20240608
由于用brew 升级了go :install go
发现goland 又不能调试了
go version 提示如下:go: cannot find GOROOT directory: /opt/homebrew/Cellar/go/1.19/libexec
1,官网重新下载安装 go1.22.4.darwin-arm64.pkg
2, 下载安装goland-2024.1.2-aarch64.dmg
3, open ~/.zshrc
export GOROOT=/usr/local/go
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOBIN
4, brew uninstall delve
5, brew install delve
6, cd /opt/homebrew/Cellar/delve/1.22.1/bin
cp dlv /Applications/GoLand.app/Contents/plugins/go-plugin/lib/dlv
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· 展开说说关于C#中ORM框架的用法!
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
2015-08-20 log4net 性能测试
2015-08-20 mysql 并发测试