Home > Enterprise >  Unable to debug Golang on Vscode M1 Mac (arm64)
Unable to debug Golang on Vscode M1 Mac (arm64)

Time:04-12

I have an M1 mac and cannot invoke functions via DLV in VSCode.

Unable to evaluate expression: backend does not support function calls

Delve Debugger
Version: 1.8.2
❯ go version                                                                                                                                              ─╯
go version go1.18 darwin/arm64

What am I missing?

Launch.JSON file

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Launch file",
      "type": "go",
      "request": "launch",
      "mode": "auto",
      "program": "${file}",
      "env": {
        "PATH": "/usr/local/go/bin:${fileDirname}"
      },
      "args": []
    }
  ]
}

CodePudding user response:

The following json works for me-

 {
        "version": "0.2.0",
        "configurations": [
            {
                "name": "DEV",
                "type": "go",
                "request": "launch",
                "mode": "auto",
                "program": "${workspaceFolder}",
                "env": {
                    "ENV_SERVERADDRESS": "0.0.0.0:7171",
                }
            }
        ] 
 }

CodePudding user response:

On an M1:

{
    // 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": "Debug normal",
            "type": "go",
            "request": "launch",
            "mode": "auto",
            "program": "${workspaceRoot}",
            "env": {},
            "args": []
        },
        {
            "name": "Debug arg=migrate",
            "type": "go",
            "request": "launch",
            "mode": "auto",
            "program": "${workspaceRoot}",
            "env": {},
            "args": [
                "migrate"
            ]
        }
    ]
}

Which Go version?

Did you install delve with that version?

  • Related