This is followed by Microsoft/vscode-go issue 219, and still open.
Yes - the VS Code debugger console doesn't currently support piping any input through to stdin.
FYI, you can tell the Code debugger to use an external console in the launch config:
"externalConsole": true
It has a possible workaround, using remote debug + vscode task, but that is not trivial.
tasks.json
:
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "echo",
"type": "shell",
"command": "cd ${fileDirname} && dlv debug --headless --listen=:2345 --log --api-version=2",
"problemMatcher": [],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
launch.json
:
{
// 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": "Connect to server",
"type": "go",
"request": "launch",
"mode": "remote",
"remotePath": "${fileDirname}",
"port": 2345,
"host": "127.0.0.1",
"program": "${fileDirname}",
"env": {},
"args": []
}
]
}
Run the task using shortcut key(command/control + shift + B), vscode will start a new shell and run the delve server.
Press F5 to debug the .go file. It works fine for me.