'GO VSCode debugger not working on Apple with M1 Chip

I can run the go files, but I can't debug them in vscode.

Error: "Failed to launch: could not launch process: can not run under Rosetta, check that the installed build of Go is right for your CPU architecture"



Solution 1:[1]

In additional answer to someone who don't see "dlv" in Go: Install/Update Tools

There're 2 solutions

  1. Remove "dlv" from go/bin -> reopen VSCode -> Run debugger -> Install "dlv" from VSCode the notification

  2. Try to update it manually by using

    go install -v github.com/go-delve/delve/cmd/dlv@latest

Hope this help you guys :)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sarawut Phusomboon