在Vscode中搭建Go环境

本文介绍如何在Visual Studio Code中搭建Go开发环境,并解决在使用go get命令时遇到的连接超时问题。通过配置国内代理,成功下载并安装了gocode等依赖包。

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

在Vsc中搭建Go环境

其中一步需要在命令行中执行命令
go get -u -v github.com/nsf/gocode
但是一直出现问题:

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.cn,在命令行中执行以下命令:

go env -w GOPROXY=https://goproxy.cn

然后一切就正常了

go: downloading github.com/nsf/gocode v0.0.0-20190302080247-5bee97b48836
go get: installing executables with 'go get' in module mode is deprecated.
        Use 'go install pkg@version' instead.
        For more information, see https://golang.org/doc/go-get-install-deprecation
        or run 'go help get' or 'go help install'.
github.com/nsf/gocode

在go的bin文件夹下出现了gocode.exe
在这里插入图片描述
在VSC中搭建go环境教程请参考:https://www.cnblogs.com/mstmdev/p/5454981.html
关于NodeJS的下载和安装:https://www.cnblogs.com/liuqiyun/p/8133904.html


报错 Couldn‘t start dlv dap,请参考文章:https://blog.youkuaiyun.com/lmy_loveF/article/details/119563126
在VSC中搭建go环境教程也请参考:https://blog.youkuaiyun.com/qq_42912216/article/details/121100912?spm=1001.2014.3001.5501

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值