windows系统使用Vscode在WSL调试golang本地进程

背景:

windows10企业版

vscode+golang1.20

wsl编译运行。

vscode 使用本地wsl进行进程attach操作,发现:Access is denied.

本地进程启动,vscode调试进程。windows-Linux控制台:

bash 复制代码
Starting: C:\Users\book\go\bin\dlv.exe dap --listen=127.0.0.1:61732 from D:\test\job
DAP server listening at: 127.0.0.1:61732

表明:使用的是windows配置环境(dlv.exe)

解决方案:切换WSL环境:

  • 点击:><

  • 切换:

  • 显示:

    此时lauch.json运行使用的是wsl环境(dlv)

bash 复制代码
Starting: /home/book/go/bin/dlv dap --listen=127.0.0.1:63282 --log-dest=3 from /mnt/d/test/job
DAP server listening at: 127.0.0.1:63282
closing connection from different user (127.0.0.1:63284): connections to localhost are only accepted from the same UNIX user for security reasons
2024-02-27T17:08:35+08:00 error layer=dap Error accepting client connection: Only connections from the same user that started this instance of Delve are allowed to connect. See --only-same-user.
dlv dap (17665) exited with code: 0

报错原有是:用户不同

ref:

https://blog.csdn.net/qq_58307541/article/details/125738589

https://stackoverflow.com/questions/69442767/how-can-i-fix-the-vscode-debuger-in-vscode

相关推荐
NiceCloud喜云5 小时前
IntelliJ IDEA 保姆级安装 + ClaudeAPI 配置教程
java·开发语言·前端·ide·chrome·docker·intellij-idea
zmsofts9 小时前
IntelliJ IDEA)因为内存不足而崩溃
java·ide·intellij-idea
Java面试题总结11 小时前
Go 里什么时候可以“panic”?
开发语言·后端·golang
安大小万13 小时前
VSCode的json文件不允许注释的解决办法
ide·vscode·编辑器
skilllite作者14 小时前
SkillLite Channel 与 Gateway 配置完全指南:Webhook、环境变量与桌面助手
ide·后端·前端框架
Jing_jing_X14 小时前
通义灵码Lingma IDE:解决你的提示词焦虑
java·ide·ai
jiayong2315 小时前
IDEA 中进行分支双向同步操作指南
java·ide·intellij-idea
MrXun_15 小时前
pycharm 无法下载插件,提示网络错误
ide·python·pycharm
拉不拉斯15 小时前
vsCode远程连接Centos 7出现的错误以及解决办法
ide·vscode·centos
wild-civil15 小时前
解决Keil 生成的文件在 VSCode 乱码问题(自动识别,不用手动改编码)
ide·vscode·stm32·编辑器