解决Mac M1 debug报错(could not launch process: can not run under Rosetta)
在M1环境下使用vscode或goland 调试报以下错误
could not launch process: can not run under Rosetta, check that the installed build of Go is right for your CPU architecture
主要原因:
M1芯片基于ARM架构,如果安装的Golang SDK为ARM就在Debug时候会报以上错误
解决方法:
重新下载ARM 版本Go SDK,Golang Installer会自动覆盖以前的版本

安装后 go env查看
golang 调试需要用到dlv,如果没有安装则需要安装dlv
go install github.com/go-delve/delve/cmd/dlv
再次Debug,发现可以正常调试