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

相关推荐
0wioiw09 小时前
Onesignal(Xcode)
ide·macos·xcode
chillxiaohan11 小时前
GO学习记录——多文件调用
开发语言·学习·golang
小乔的编程内容分享站12 小时前
记录使用VSCode调试含scanf()的C语言程序出现的两个问题
c语言·开发语言·笔记·vscode
zzh_my14 小时前
Visual Studio 2022介绍
ide·visual studio
Grassto15 小时前
11 Go Module 缓存机制详解
开发语言·缓存·golang·go·go module
mancy_12121216 小时前
复古C语言代码复活!——以121+hello.c为例摘要
c语言·vscode·gitee·visual studio·新人首发·turbo c
星辰引路-Lefan16 小时前
Antigravity 登录问题及解决方案:Antigravity Tools 账号管理工具详解
ide·ai编程·gemini·antigravity
福大大架构师每日一题16 小时前
ollama v0.15.2发布:新增Clawdbot集成指令,全面支持Ollama模型启动!
golang·ollama
*小海豚*16 小时前
springcloud项目运行启动类无法启动,IDEA也没有任何提示
java·ide
参.商.18 小时前
【Day25】26.删除有序数组中的重复项 80.删除有序数组中的重复项II
leetcode·golang