Win10, vscode 调试go代码时,安装dlv失败

Win10, vscode 调试go代码时,安装dlv失败。

错误提示:

Installing 1 tool at C:\Users\haozhuan\go\bin in module mode.
dlv
Installing github.com/go-delve/delve/cmd/dlv@latest FAILED
{
“killed”: false,
“code”: 1,
“signal”: null,
“cmd”: “C:\Program Files (x86)\Go\bin\go.exe install -v github.com/go-delve/delve/cmd/dlv@latest”,
“stdout”: “”,
“stderr”: “C:\Users\haozhuan\go\pkg\mod\github.com\go-delve\[email protected]\service\debugger\debugger.go:28:2: found packages native (proc.go) and your_operating_system_and_architecture_combination_is_not_supported_by_delve (support_sentinel.go) in C:\Users\haozhuan\go\pkg\mod\github.com\go-delve\[email protected]\pkg\proc\native\n”
}
1 tools failed to install.
dlv: failed to install dlv(github.com/go-delve/delve/cmd/dlv@latest): Error: Command failed: C:\Program Files (x86)\Go\bin\go.exe install -v github.com/go-delve/delve/cmd/dlv@latest
C:\Users\haozhuan\go\pkg\mod\github.com\go-delve\[email protected]\service\debugger\debugger.go:28:2: found packages native (proc.go) and your_operating_system_and_architecture_combination_is_not_supported_by_delve (support_sentinel.go) in C:\Users\haozhuan\go\pkg\mod\github.com\go-delve\[email protected]\pkg\proc\native

分析

根据提示: your_operating_system_and_architecture_combination_is_not_supported_by_delve, 系统和架构不支持delve.

解决方案

设置go 环境变量

go env -w GOARCH=amd64

再安装,成功:

Installing 1 tool at C:\Users\haozhuan\go\bin in module mode. dlv

Installing github.com/go-delve/delve/cmd/dlv@latest (dlv) SUCCEEDED

All tools successfully installed. You are ready to Go.

你可能感兴趣的:(笔记,vscode,golang,ide)