使用goland 进行本地调试的时候报错:
could not launch process: can not run under Rosetta, check that the installed build of Go is right for your CPU architecture
输入命令 go env GOARCH , 显示 amd64, 查了下资料, amd64 是go mac 的 x86架构版本。 而我的电脑是M2芯片的, 应该使用arm64 版本的go。
我是用homebrew 安装的go , 对于m2 芯片的电脑 使用homebrew 安装的时候, 默认会安装 amd64 架构版本的 go。
把go 卸载了, 从官网上下载一个arm64 的安装包重新下载。 注意要重新设置goroot 路径。