什么是dep?
dep和go,在一定程度上相当于maven之于Java,composer之于PHP,dep是go语言官方的一个包管理工具。
相比较go get而言,dep可以直接给引入的第三方包一个专门的目录,并且可以专门制定一个配置文件,控制go项目所引入的包,版本以及其他依赖关系。
dep这个项目放在golang官方的github中:https://github.com/golang/dep
官方对于dep的解释是:dep is the official experiment, but not yet the official tool. 也就是说,dep目前还处于试验阶段,还并没有成为一个官方意义上的工具。毕竟go语言还很年轻,但是这也充分的证明了go语言的生态圈十分丰富。 安装
安装dep工具的方式有很多种,如果是mac电脑的话,只需要如下命令:
brew install dep
对于Linux和类Unix系统而言,我们还可以使用如下方式安装dep:
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
Dep is a tool for managing dependencies for Go projects
Usage:
"dep [command]"
Commands:
init Set up a new Go project, or migrate an existing one
status Report the status of the project
's dependencies ensure Ensure a dependency is safely vendored in the project
version Show the dep version information
Examples:
dep init set up a new project
dep ensure install the project's dependencies
dep ensure -update update the locked versions of all dependencies
dep ensure -add github.com/pkg/errors add a dependency to the project
Use "dep help [command]" for more information about a command.