问题描述:
在m1环境下,使用GoLand工具,项目可以正常Run,但无法Debug运行。
error:could not launch process: can not run under Rosetta, check that the installed build of Go is right for your CPU architecture
解决过程:
- 百度一下,想着快速解决,发现 别说解决方案了,连相似的问题都几乎没有;
- 还是得上Google,哦豁,发现两个已经Closed issue,应该很快就可以了吧;
- 怎么大家还都在讨论呢,甚至发现最近还有人回复:”the issue still exist”;
- 不是吧。。看看可能的原因吧;
- 接下来就被带到dlv的坑里了;
- 更新最新的dlv, ensure that the tools, Delve and GDlv, are built and installed using the M1 version of Go.
- go install github.com/go-delve/delve/cmd/dlv@latest
- go install github.com/aarzilli/gdlv@latest
- 还是不行!更新Go版本到最新的吧,1.18, Debug 冲! 还是失败了;
- … 安装尝试各种版本,尝试版本对齐 …
- 嘶..这可如何是好。这时 被重启了N次GoLand在左下角弹出一个⚠️框,内容大概是:安装apple芯片的版本,可以发挥其最佳性能;
- 难道这个最佳性能,指的是最基础的功能补全??我’被迫’进了其官网,发现还真有一个macOS Apple Silicon这样的独立版本;
- 换下GoLand试试吧,done。