Go依赖管理工具(四) glide

上一篇

Go依赖管理工具(三)govender

首先澄清一点,这个项目不是android里面的glide,用于图片加载和缓存的那个glide。而是做go package管理的glide

安装方法

go get github.com/Masterminds/glide

使用

glide init/create去创建glide.yaml

glide会扫描项目的dependency,并打出日志

wujingcideMacBook-Pro:historyKite wujingci$ glide create
[INFO]  Generating a YAML configuration file and guessing the dependencies
[INFO]  Attempting to import from other package managers (use --skip-import to skip)
[INFO]  Scanning code to look for dependencies
[INFO]  --> Found reference to xxxxxxxxxxx
[INFO]  --> Found reference to xxxxxxxxxxx
[INFO]  --> Found reference to xxxxxxxxxxx
[INFO]  --> Found reference to xxxxxxxxxxx
[INFO]  --> Found reference to xxxxxxxxxxx
[INFO]  --> Found reference to xxxxxxxxxxx
[INFO]  --> Found reference to xxxxxxxxxxx
[INFO]  Writing configuration file (glide.yaml)
[INFO]  Would you like Glide to help you find ways to improve your glide.yaml configuration?
[INFO]  If you want to revisit this step you can use the config-wizard command at any time.
[INFO]  Yes (Y) or No (N)?

N
[INFO]  You can now edit the glide.yaml file. Consider:
[INFO]  --> Using versions and ranges. See https://glide.sh/docs/versions/
[INFO]  --> Adding additional metadata. See https://glide.sh/docs/glide.yaml/
[INFO]  --> Running the config-wizard command to improve the versions in your configuration
wujingcideMacBook-Pro:historyKite wujingci$ cat glide.yaml
package: xxxxxxx/willen.wu/historyKite
import:
- package: xxxxxxx
- package: xxxxxxx
- package: xxxxxxx
- package: xxxxxxx
- package: xxxxxxx
- package: xxxxxxx
- package: xxxxxxx

glide get会去get glide.yaml里面的dependency并存到vendor目录下

上传项目时候vendor 目录ignore掉

别的同学新拉branch下来只要用

glide install就可以获得所有包并存进vendor里面
glide与golang的依赖管理工具,之前提到的三个相比

Go依赖管理工具(一)godep

Go依赖管理工具(二)dep

Go依赖管理工具(三)govendor

是不将dependency放置到GOPATH去的,这一点很不一样,因此新拉一个目录编比较花时间,不过也可以手动拷package到vendor里面,使用时候可以考虑这个功能的优劣

你可能感兴趣的:(golang,实战)