【Go】解决VS Code安装Go插件失败问题
环境说明
Win10
Go 1.17.3
VS Code 1.62.2
问题现象
使用vscode开发go程序时,提示未安装go插件,点击Install ALL
会报一堆安装失败
go-outline: Error: Command failed: D:\Go\bin\go.exe get -u -v github.com/ramya-rao-a/go-outline github.com/ramya-rao-a/go-outline (download) Fetching https://golang.org/x/tools/go/buildutil?go-get=1 https fetch failed: Get https://golang.org/x/tools/go/buildutil?go-get=1: dial tcp 216.239.37.1: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.
解决办法
使用https://goproxy.io代理
在CMD窗口中设置Go环境变量
go env -w GO111MODULE=on go env -w GOPROXY=https://goproxy.io,direct
关闭,重新打开vscode,点击Install All即可完成安装