Debugging with vscode or goland in M1 environment reports the following errors
could not launch process: can not run under Rosetta, check that the installed build of Go is right for your CPU architecture
main cause:
M1 chip is based on ARM architecture. If the installed Golang SDK is ARM, the above error will be reported during debugging
Solution:
Re-download the Go SDK of ARM version, and the Golang Installer will automatically overwrite the previous version
Go env to view after installation
Dlv is required for golang debugging. If dlv is not installed, dlv must be installed
go install github.com/go-delve/delve/cmd/dlv
Debug again. It is found that debugging can be performed normally