VScode中GO插件依赖安装失败问题
在VScode中下载并启用GO插件的时候,会提示需要安装一些依赖(如下所示)
点击 install all后:
Tools environment: GOPATH=D:\BJ-Golang\gocode_lm
Installing 8 tools at D:\BJ-Golang\gocode_lm\bin in module mode.
go-outline
gotests
gomodifytags
impl
goplay
dlv
staticcheck
gopls
报错如下:
Installing github.com/ramya-rao-a/go-outline@latest FAILED
{
"killed": false,
"code": 1,
"signal": null,
"cmd": "E:\\programs\\go\\bin\\go.exe install -v github.com/ramya-rao-a/go-outline@latest",
"stdout": "",
"stderr": "go: github.com/ramya-rao-a/go-outline@latest: module github.com/ramya-rao-a/go-outline: Get \"https://proxy.golang.org/github.com/ramya-rao-a/go-outline/@v/list\": dial tcp 142.251.42.241:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.\n"
}
参考:
在%GOPATH%\src\目录下,建立路径golang.org\x
(我的GOPATH=D:\BJ-Golang\gocode_lm)
进入到%GOPATH%\src\golang.org\x,下载需要工具的源码git clone https://github.com/golang/tools.git
同样的步骤创建%GOPATH%\src\github.com\golang,然后git clone https://github.com/golang/tools.git
进入到%GOPATH%下,执行
go install github.com/ramya-rao-a/go-outline
//其中github.com/ramya-rao-a/go-outline部分根据前面自动install中的报错更改即可
//例如:报错信息:
//dlv: failed to install dlv(github.com/go-delve/delve/cmd/dlv@latest): Error: Command failed: E:\programs\go\bin\go.exe install -v github.com/go-delve/delve/cmd/dlv@latest
//go: github.com/go-delve/delve/cmd/dlv@latest: module github.com/go-delve/delve/cmd/dlv: Get "https://proxy.golang.org/github.com/go-delve/delve/cmd/dlv/@v/list": dial tcp 142.251.43.17:443: connectex: A connection //attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
//则 go install github.com/go-delve/delve/cmd/dlv
//如果此时报错,则改为以下顺序:
//go get github.com/go-delve/delve/cmd/dlv
//go install github.com/go-delve/delve/cmd/dlv