-1

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?

plauwh
  • 21
  • 3

2 Answers2

0

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.

Zeke Lu
  • 6,349
  • 1
  • 17
  • 23
0

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

{
  "go.delveConfig": {
    "dlvFlags": [
      "--check-go-version=false"
    ]
  },
}
menya
  • 1,459
  • 7
  • 8