golang的包管理系统比较

下面是测试结果

- 自带的vendor

- 项目创建vendor子目录,然后github的地址放进去就ok了

- govendor

- 安装:go get -u github.com/kardianos/govendor

- 初始化:govendor init

- 测试:govendor fetch github.com/ziyouchutuwenwu/objective-go

- 问题:

fetch貌似没有把所有的子目录都弄下来

get装到GOPATH里面去了,蛋疼

- gvt

- 安装:go get -u github.com/FiloSottile/gvt

- 测试:gvt fetch github.com/ziyouchutuwenwu/objective-go

- 优势:

全部下载,支持tag和branch下载

- gb

- 安装:go get github.com/constabulary/gb/...

- 测试:gvt fetch github.com/ziyouchutuwenwu/objective-go

- 问题:

先下载依赖库,成功以后下载需要的repo,全部成功以后才会在vendor目录里面,在天朝,golang.org的访问出问题,这个模式不太好

- glide

- 安装:go get github.com/Masterminds/glide

- 初始化:glide create

- 下载:glide install

- 优势:

根据你的代码自动发现需要的import包,创建yaml文件,适合团队合作(没必要在自己的项目repo里面带一堆三方库,靠这个就可以了)

支持自定义镜像,这个在别的里面没发现

直接glide

配置方式

rm -rf ~/.glide

mkdir -p ~/.glide

glide mirror set https://golang.org/x/mobile https://github.com/golang/mobile --vcs git

glide mirror set https://golang.org/x/crypto https://github.com/golang/crypto --vcs git

glide mirror set https://golang.org/x/net https://github.com/golang/net --vcs git

glide mirror set https://golang.org/x/tools https://github.com/golang/tools --vcs git

glide mirror set https://golang.org/x/text https://github.com/golang/text --vcs git

glide mirror set https://golang.org/x/image https://github.com/golang/image --vcs git

glide mirror set https://golang.org/x/sys https://github.com/golang/sys --vcs git

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • afinalAfinal是一个android的ioc,orm框架 https://github.com/yangf...
    passiontim阅读 15,705评论 2 45
  • Astronomygonova - A wrapper for libnova -- Celestial Mech...
    JumboWu阅读 12,960评论 0 41
  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 135,600评论 19 139
  • 因为别人无心或有心的一句话搞得自己整晚都不爽。怎么样才能做到不让其他人影响你的情绪?要做无心无脑人吗?那岂不是成了...
    41aa98ac3084阅读 1,729评论 0 0
  • 本人学生党,被老师要求在这里写技术博客。因此所有内容仅供参考,不保证100%准确。
    梳打水阅读 2,870评论 0 0