vscode 在windows 10下无法调试golang程序
1. 运行环境
//: <go version go1.21.1 windows/amd64> (当前使用的Go
版本,及系统版本、系统架构?)
//: <go version go1.21.1 windows/amd64> (使用go version
命令查看,期望的结果如:go 1.12, linux/amd64
)
2. 问题描述?
// 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": "Launch",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}",
"env": {},
"args": []
}
]
}> (代码问题的话,请提供一份最短的,可复现代码。或相关代码。)
3. 您期望得到的结果?
4. 您实际得到的结果?
//: <Starting: C:\Users\monkeycd\go\bin\dlv.exe dap –listen=127.0.0.1:40314 from C:\Users\monkeycd\Desktop\go\project\json.Unmarshal
DAP server listening at: 127.0.0.1:40314
Build Error: go build -o C:\Users\monkeycd\Desktop\go\project\json.Unmarshal__debug_bin3723224509.exe -gcflags all=-N -l .
warning: GOPATH set to GOROOT (C:\Users\monkeycd\go) has no effect
no Go files in C:\Users\monkeycd\Desktop\go\project\json.Unmarshal (exit status 1)> (有报错信息的话把堆栈信息提供出来)