Older go version not working run and debug Delve

470 views Asked by At

I have multiple go versions installed, 1.20.5 and 1.17.9

I am using Go 1.17.9 for this project as when I run go version I get go version go1.17.9 linux/amd64

Using run and debug in delve, with my launch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch Package",
            "type": "go",
            "request": "launch",
            "mode": "auto",
            "program": "${fileDirname}",
            "envFile": "${workspaceFolder}/.env",
        }
    ]
}

I get: "Version of Delve is too old for Go version 1.20.5 (maximum supported version 1.18, suppress this error with --check-go-version=false)"

How can I make it so that Go version 1.17.9 is used in Run and Debug?

2

There are 2 answers

0
Zeke Lu On

You can Choose Go Environment in vs-code to choose another version of Go. See the screenshot below:

Choose Go Environment

See also Switching Go version when process.env["GOROOT"] is set is unsupported if you failed to switch to another version of Go.

0
menya On

you can add customize args to delve in $(pwd)/.vscode/settings.json

{
  "go.delveConfig": {
    "dlvFlags": [
      "--check-go-version=false"
    ]
  },
}