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

相关推荐
fruge3 小时前
Visual Studio 2022安装时共享组件、工具、SDK路径无法更改的问题
ide·visual studio
猫梦www3 小时前
力扣21:合并两个有序链表
数据结构·算法·leetcode·链表·golang·力扣
我狸才不是赔钱货8 小时前
DevOps:打破开发与运维之间的高墙
运维·vscode·docker·devops
std78798 小时前
Rust 与 Go – 比较以及每个如何满足您的需求
开发语言·golang·rust
我狸才不是赔钱货9 小时前
揭开命令行的面纱:终端、CLI、Shell的终极辨析
vscode·ssh·bash
007php00710 小时前
猿辅导Java面试真实经历与深度总结(二)
java·开发语言·python·计算机网络·面试·职场和发展·golang
不吃凉粉18 小时前
Android Studio USB串口通信
android·ide·android studio
编程乐学19 小时前
安卓非原创--基于Android Studio 实现的天气预报App
android·ide·android studio·课程设计·大作业·天气预报·安卓大作业
非得登录才能看吗?21 小时前
VScode 入门(设置篇)
ide·vscode·编辑器
Costrict1 天前
解锁新阵地!CoStrict 现已支持 JetBrains 系列 IDE
大数据·ide·人工智能·深度学习·自然语言处理·ai编程·visual studio