我在Visual Studio代码中遇到了Delve调试器的问题。调试开始,但没有任何反应。控制台中只有信息:
time="2018-06-23T16:35:55+02:00" level=info msg="launching process with args: [C:\\Users\\LenovoPC\\go\\src\\test\\debug]" layer=debugger
launch.json的配置
"version": "0.2.0",
"configurations": [
{
"name": "Launch",
"type": "go",
"request": "launch",
"mode": "debug",
"remotePath": "",
"port": 2345,
"host": "127.0.0.1",
"program": "${workspaceRoot}",
"env": {},
"args": [],
"showLog": true
}
]
答案 0 :(得分:2)
根据您安装delve的方式,它最终会出现在PATH或 GOPATH / bin。如果dlv二进制文件位于您的GOPATH / bin中,而该GOPATH不是 设置为环境变量,然后确保PATH指向 该GOPATH / bin,以便Go扩展程序可以找到dlv二进制文件。
尝试将目录更改为filename,以从项目文件夹的main.go
中运行项目,
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch",
"type": "go",
"request": "launch",
"mode": "debug",
"remotePath": "",
"port": 2345,
"host": "127.0.0.1",
"program": "${fileDirname}",
"env": {},
"args": [],
"showLog": true
}
]
}
确保设置了$ GOPATH(例如〜/ .go) 在终端上运行命令
go env
检查GOROOT
和GOPATH
变量以查看delve是否与它们同步
更多信息,结帐https://laravel.com/docs/5.6/helpers#method-array-pluck