-2

Question is not to how to debug, It's like how to set up debugger on architecture and version.

I don't want to update go without rosetta, It has to be run on same set up.

Here is system,

  1. Go version 1.16 (Not the latest one)
  2. Mac M1 with Rosetta Terminal.

Here is

launch.json

file.

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch",
            "type": "go",
            "request": "launch",
            "mode": "debug",
            "remotePath": "",
            "program": "${workspaceRoot}",
            "env": {},
            "args": [],
            "showLog": true
        }
    ]
}

enter image description here

Solid Soft
  • 1,872
  • 2
  • 25
  • 55

2 Answers2

1

As the error message indicates, make sure your Go tools AND VSCode are the versions for M1 (darwin/arm64).

Hana
  • 565
  • 5
  • 9
  • I see error, I have rosetta terminal due to some other brew. Any way to add another GO arch? I have GOARCH="amd64" I don't want to remove amd64 go arch. – Solid Soft Jan 05 '22 at 17:02
  • 1
    Sorry, delve (the Go debugger) does not support that kind of setup. – Hana Jan 06 '22 at 00:20
0

I had the same issue debugging an application on my Macbook Pro M1 a few weeks using VS Code, without any extra configuration. I was able to fix it with this steps (in case it helps someone else)

  • Reinstall GO using the ARM64 installation package from https://golang.org - https://go.dev/dl/go1.18.darwin-arm64.pkg (the installer already takes care of removing the previous version )
  • Reinstall your Go Visual Code Extensions
  • Reinstall Delve (debugger for go), you can do it by running go install github.com/go-delve/delve/cmd/dlv@latest from the command line.
  • Reinstall gDelve (GUI for delve), you can do this by running go install github.com/aarzilli/gdlv@latest from the command line.
  • Restart your VS Code

Although step one should be more than enough to have full compatibility with the M1 processor architecture, it is not enough to debug the applications using VS Code, since the previously installed version of Delve may not be the correct one.

  • I need amd64 arch golang version. Will it work with this env? – Solid Soft Mar 22 '22 at 06:11
  • I have the M1 chip in my mac, with the amd64 arch I was able to run the applications but not debug them. But you should try, install and reinstall different versions of go is easy and not take too much time – nelegatti Mar 23 '22 at 12:23