Vs 配置 GO依赖

VS配置GO依赖

  1. 安装vs code,这一步很简单不做描述,下载地址:https://code.visualstudio.com/

  2. 安装完vs code后,搜索扩展(ctrl+shift+X)go 第一个就是,然后点击安装,安装之后,会弹出弹框安装依赖插件,但是因为有墙,所以基本所有依赖都会下载失败

  3. 安装依赖不成功,采用手动方式,首先在你的GOPATH下创建src\github.com和src\golang.org\x两个目录

  4. 接下来在x目录下,运行命令

git clone http://github.com/golang/tools

git clone https://github.com/golang/lint

    5.  执行结束后就切换到github.com目录执行命令

git clone https://github.com/mdempsky/gocode

git clone https://github.com/uudashr/gopkgs/cmd/gopkgs(已变更,具体看下文)

git clone https://github.com/ramya-rao-a/go-outline

git clone https://github.com/acroca/go-symbols

git clone https://golang.org/x/tools/cmd/guru

git clone https://golang.org/x/tools/cmd/gorename

git clone https://github.com/go-delve/delve/cmd/dlv(已变更,具体看下文)

git clone https://github.com/stamblerre/gocode

git clone https://github.com/rogpeppe/godef

git clone https://github.com/sqs/goreturns

git clone https://golang.org/x/lint/golint

两个包路径已经更改

git clone https://github.com/uudashr/gopkgs/cmd/gopkgs -> git clone https://github.com/uudashr/gopkgs

git clone https://github.com/go-delve/delve/cmd/dlv -> git clone https://github.com/go-delve/delve

   6.  执行完上诉命令后,切换到GOPATH下,执行install命令,注意github.com目录下的所有包都没有创建相应的路径所以需要下载下来后,手动创建路径,比如上面有两个gocode,下载完第一个后第二个就会报错已存在,且不为空

go install github.com/mdempsky/gocode

go install github.com/uudashr/gopkgs/cmd/gopkgs

go install github.com/ramya-rao-a/go-outline

go install github.com/acroca/go-symbols

go install golang.org/x/tools/cmd/guru

go install golang.org/x/tools/cmd/gorename

go install github.com/go-delve/delve/cmd/dlv

go install github.com/stamblerre/gocode

go install github.com/rogpeppe/godef

go install github.com/sqs/goreturns

go install golang.org/x/lint/golint

执行到底二条install命令时,可能报错,如下图:

有两个项目找不到,这个时候复制找不到的包,从git上再次获取,同样的获取需要从GOPATH\src\github.com 下进行,运行命令

git clone https://github.com/karrick/godirwalk

git clone https://github.com/pkg/errors

一直配置到运行到第五条又报错包不存在

同上,继续下载包,但是这次报错是在golang.org下,所以,要切换到golang.org\x下运行

git clone https://github.com/golang/mod.git

git clone https://github.com/golang/xerrors

接下来其他的应该就不会报错了,如果有报错,多半也是不存在包,根据报错的信息,去下载对应的包就行了。

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值