Basic config

  1. install delve
  2. use debug config template in vscode

Debug with stdin input

The default delve debug mod doesn’t support stdin input. To tackle this issue, use the method of launching a delve debug server and attach program to debug server instead.


  "tasks": [
      "label": "Delve debug server",
      "type": "shell",
      "command": "cd \"${fileDirname}\" && source /etc/profile && ~/go/bin/dlv debug --headless --listen=:2346 --api-version=2",
      "problemMatcher": [],
      "group": {
        "kind": "build",
        "isDefault": false
  "version": "2.0.0"


  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more information, visit:
  "version": "0.2.0",
  "configurations": [
      "name": "Go: Connect to dlv server",
      "type": "go",
      "request": "attach",
      "mode": "remote",
      "remotePath": "${workspaceFolder}",
      "port": 2346,
      "host": "",
      "internalConsoleOptions": "neverOpen"