当前位置:网站首页>如何安装govendor并打开项目
如何安装govendor并打开项目
2022-07-25 16:18:00 【Melody2050】
安装govendor
参考Go Dependencies via govendor
English
使用go 1.18,在任意目录执行go install安装govendor
go install github.com/kardianos/[email protected]
将项目放置到$GOPATH/src1,在项目内列出依赖列表
govendor list
可以看到该项目内的各种依赖
...
l moby/volume
l moby/volume/drivers
l moby/volume/local
l moby/volume/mounts
l moby/volume/service
l moby/volume/service/opts
l moby/volume/testutils
m appengine
m appengine_internal
m appengine_internal/base
之后对每个没下载的依赖执行fetch即可:
govendor fetch github.com/docker/docker/pkg/reexec
govendor fetch github.com/docker/docker/rootless
...
不过用fetch的做法有点低效,笔者还没找到其他高效做法
踩坑
下载govendor失败
a connection attempt failed because the connected party did not properly respond after period of tim
GO A connection attempt failed because the connected party did not properly respond after a period…
如果go install下载失败,需要修改go的代理为国内镜像
go env -w GOPROXY=https://goproxy.cn
govendor路径错误
govendor error package not a go package or not in gopath
你的项目没有放置在$GOPATH/src。
首先执行go env GOPATH查看路径,如果是不符合预期的,就参考windows11 如何修改环境变量,修改GOPATH系统变量。
删除govendor依赖
使用govendor fetch github.com/spf13/cobra来下载依赖,并到$GOPATH/.cache下删除依赖。
拉取不到指定分支
执行了govendor fetch命令后, 报错如下
D:\codes\src\moby>govendor fetch github.com/spf13/cobra
# cd D:\codes\.cache\govendor\github.com\spf13\cobra; git reset --hard origin/master
fatal: ambiguous argument 'origin/master': unknown revision or path not in the working tree
.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
Error: failed to sync to latest revision exit status 128
Failed to fetch package "github.com/spf13/cobra"
可以看到,govendor尝试执行git reset --hard origin/master,但找不到这个分支,因为原仓库本来就没这个分支

所以改为运行后,执行成功
govendor fetch github.com/spf13/[email protected]
参考Go Vendoring Beginner Tutorial的相关说明,提到
Go to your project directory (it must be in the GOPATH src)可知,项目必须在GOPATH的src目录下。 ︎
边栏推荐
- Recommended collection, which is probably the most comprehensive coding method summary of category type features
- Is the win11 dynamic tile gone? Method of restoring dynamic tile in Win 11
- 伦敦银K线图的各种有用形态
- What is a physical firewall? What's the effect?
- Leetcode:528. select randomly according to the weight [ordinary random failure + prefix and dichotomy]
- MySQL tutorial 67- filter duplicate data using distinct
- 开发者如何为React Native选择合适的数据库
- Release of v6.5.1/2/3 series of versions of Xingyun housekeeper: the ability of database OpenAPI continues to be strengthened
- PageHelper.startPage没有生效问题
- 02. 将参数props限制在一个类型的列表中
猜你喜欢

Save the image with gaussdb (for redis), and the recommended business can easily reduce the cost by 60%

测试驱动开发(TDD)在线练功房 | 9月17日开课

Which led display manufacturer is better
![[zeloengine] summary of pit filling of reflection system](/img/7a/c85ba66c5dd05908b2d784fab306a2.png)
[zeloengine] summary of pit filling of reflection system

Win11动态磁贴没了?Win11中恢复动态磁贴的方法

How to build an enterprise level OLAP data engine for massive data and high real-time requirements?

How does win11's own drawing software display the ruler?

leetcode:154. 寻找旋转排序数组中的最小值 II【关于旋转排序数组的中后定位二分法】

Exploration of 6-wire SPI transmission mode
![Leetcode:154. find the minimum value II in the rotation sort array [about the middle and rear positioning dichotomy of the rotation sort array]](/img/03/54a2d82a17cd07374dc0aedacd7b11.png)
Leetcode:154. find the minimum value II in the rotation sort array [about the middle and rear positioning dichotomy of the rotation sort array]
随机推荐
微信小程序不使用插件,渲染富文本中的视频,图片自适应,plus版本
[zeloengine] summary of pit filling of reflection system
MySQL 元数据锁(MDL)
MySQL table read lock
Exploration of 6-wire SPI transmission mode
What is a physical firewall? What's the effect?
tkinter模块高级操作(一)—— 透明按钮、透明文本框、自定义按钮及自定义文本框
面试突击:为什么 TCP 需要 3 次握手?
递归菜单查询(递归:自己查自己)
Product upgrade observation station in June
0x80131500打不开微软商店的解决办法
Dpdk packet receiving and sending problem case: non packet receiving problem location triggered by mismatched packet sending and receiving function
【ZeloEngine】反射系统填坑小结
Mysql读写锁
Differences between cookies, cookies and sessions
[image hiding] digital image watermarking method technology based on hybrid dwt-hd-svd with matlab code
mysql意向锁
PageHelper.startPage没有生效问题
mysql 表写锁
[image denoising] image denoising based on bicube interpolation and sparse representation matlab source code