内容简介:链客,有问必答!govendor依赖包管理1111
想知道更多关于区块链技术知识,请百度【链客区块链技术问答社区】
链客,有问必答!
govendor依赖包管理1111
golang工程的依赖包经常使用go get命令来获取,例如:go get github.com/kardianos/govendor ,会将依赖包下载到GOPATH的路径下。
常用的依赖包管理 工具 有godep,govendor等,在Golang1.5之后,Go提供了 GO 15VENDOREXPERIMENT环境变量(Go 1.6版本默认开启该环境变量),用于将go build时的应用路径搜索调整成为当前项目目录/vendor 目录方式。通过这种形式,我们可以实现类似于 godep 方式的项目依赖管理。
#v1.0.9
wget http://blob.wae.haplat.net/golang/govendor-v1.0.9.linux-amd64.tar.gz
tar zxvf govendor-v1.0.9.linux-amd64.tar.gz
rm /usr/bin/govendor && mv govendor /usr/bin
#进入到项目目录
cd /path/to/your/project
#初始化vendor目录
govendor init
#将GOPATH中本工程使用到的依赖包自动移动到vendor目录中
#说明:如果本地GOPATH没有依赖包,先go get相应的依赖包
govendor add +external
或使用缩写: govendor add +e
新增/更新依赖包 github拉取
# Update a package to latest, given any prior version constraint
govendor fetch golang.org/x/net/context
#使用HTTP协议
govendor fetch -insecure [url]
# Specify a specific version or revision to fetch
govendor fetch golang.org/x/net/context@a4bbce9fcae005b22ae5443f6af064d80a6f5a55
govendor fetch golang.org/x/net/context@v1 # Get latest v1.*.* tag or branch.
govendor fetch golang.org/x/net/context@=v1 # Get the tag or branch named "v1".
更新/新增依赖包 本地GOPATH拷贝
# Update packages from $GOPATH.
govendor update golang.org/x/net/context
govendor remove [pkg]
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
猜你喜欢:- Gradle构建SpringBoot程序依赖管理之依赖版本自动控制
- python的依赖管理
- govendor依赖包管理工具
- nodejs 中的依赖管理
- Golang 包和依赖管理
- golang dep 依赖管理 使用
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
How to Build a Billion Dollar App
George Berkowski / Little, Brown Book Group / 2015-4-1 / USD 24.95
Apps have changed the way we communicate, shop, play, interact and travel and their phenomenal popularity has presented possibly the biggest business opportunity in history. In How to Build a Billi......一起来看看 《How to Build a Billion Dollar App》 这本书的介绍吧!