当前位置:网站首页>如何安装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目录下。 ︎
边栏推荐
- Golang review summary
- Cookie、cookie与session区别
- 微信小程序不使用插件,渲染富文本中的视频,图片自适应,plus版本
- Paper notes: highly accurate protein structure prediction with alphafold (alphafold 2 & appendix)
- Exploration of 6-wire SPI transmission mode
- Understanding service governance in distributed development
- mysql意向锁
- tkinter模块高级操作(一)—— 透明按钮、透明文本框、自定义按钮及自定义文本框
- [fault diagnosis] bearing fault diagnosis based on Bayesian optimization support vector machine with matlab code
- TypeError: Unrecognized value type: <class ‘str‘> ParserError: Unknown string format
猜你喜欢

用递归进行数组求和

Which led display manufacturer is better

TypeError: Unrecognized value type: <class ‘str‘> ParserError: Unknown string format

如何构建面向海量数据、高实时要求的企业级OLAP数据引擎?
![[server data recovery] data recovery cases of raid information loss caused by unexpected power failure of HP EVA server storage](/img/90/51d86111b918eb60761818110cdec4.jpg)
[server data recovery] data recovery cases of raid information loss caused by unexpected power failure of HP EVA server storage

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

Product upgrade observation station in June

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

今天去 OPPO 面试,被问麻了

可验证随机函数 VRF
随机推荐
MyBaits
Understanding service governance in distributed development
百度富文本编辑器UEditor单张图片上传跨域
MySQL check whether the table is locked
意向锁(Intention Lock)
Leetcode:528. select randomly according to the weight [ordinary random failure + prefix and dichotomy]
MYSQL导入sqllite表格的两种方法
MySQL implicit lock
没错,请求DNS服务器还可以使用UDP协议
权限管理-角色分配菜单
Dpdk packet receiving and sending problem case: non packet receiving problem location triggered by mismatched packet sending and receiving function
C# 音乐
MySQL 元数据锁(MDL)
MySQL隐式锁
[zeloengine] summary of pit filling of reflection system
MySQL tutorial 67- filter duplicate data using distinct
I interviewed 8 companies and got 5 offers in a week. Share my experience
Is the win11 dynamic tile gone? Method of restoring dynamic tile in Win 11
01. A simpler way to deliver a large number of props
Permission management - role assignment menu