Golang | Visual Studio Code安装go lang 插件

本文记录了在Visual Studio Code中安装Golang插件及其依赖dlv调试工具时遇到的问题及解决过程。主要问题包括:go版本过低、安装gocode失败、golint无法安装。解决方案包括升级go版本至1.10,手动下载并放置相关文件,以及多次尝试安装golint。通过这些步骤,最终成功安装并能进行程序调试。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

本以为Visual Studio Code 安装Golang插件很容易,确实容易。但是安装Golang插件需要的插件却很麻烦。

譬如调试需要用dlv,visual studio code可以自动下载需要的插件,如下所示:

gocode
go-outline
go-symbols
guru
gorename
dlv
godef
goreturns

但是各种报错,信息如下:

Installing github.com/nsf/gocode FAILED
Installing github.com/ramya-rao-a/go-outline FAILED
Installing github.com/acroca/go-symbols FAILED
Installing golang.org/x/tools/cmd/guru FAILED
Installing github.com/golang/lint/golint FAILED

......

guru:
Error: Command failed: C:\Go\bin\go.exe get -u -v golang.org/x/tools/cmd/guru
Fetching https://golang.org/x/tools/cmd/guru?go-get=1
https fetch failed: Get https://golang.org/x/tools/cmd/guru?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.
golang.org\x\tools (download)
Fetching https://golang.org/x/tools/cmd/guru/serial?go-get=1
https fetch failed: Get https://golang.org/x/tools/cmd/guru/serial?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

......

于是各种查找安装dlv失败的解决办法,网上说的很简单,都是通过如下命令:

go get -u github.com/d
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值