“ 阅读本文大概需要3.4分钟 ”

Beego1.1Beego1.7venderdepglide

主角出场

dep

dep is a prototype dependency management tool for Go. It requires Go 1.9 or newer to compile. dep is safe for production use.

安装

brew install depcurl https://raw.githubusercontent.com/golang/dep/master/install.sh | shgo get -u github.com/golang/dep/cmd/dep$GOPATH/bin$PATH

验证

dep


功能介绍

1.dep initvendervenderGopkg.lockGopkg.tomlGopkg.tomlGopkg.lock

A manifest - a file describing the current project’s dependency requirements. In dep, this is the Gopkg.toml file.
A lock - a file containing a transitively-complete, reproducible description of the dependency graph. In dep, this is the Gopkg.lock file.

2.dep status

用来查看项目依赖的详细信息和状态,非常清晰。

3.dep ensure
4.dep ensure add   github.com/RoaringBitmap/roaring@^1.0.1
github.com/RoaringBitmap/roaring1.0.1

本地缓存

    当然dep不会每次都去下载,其工作原理和Mevan一样,会优先在本地仓库搜索,本地仓库未找到即在网络上下载,并添加到本地仓库。
$GOPATH/pkg/dep/sources