First look forward to the birth of the official go Language dependency management tool DEP. Govendor Introduction
After Golang1.5, go provides a go15vendorexperiment environment variable that is used to adjust the application path search to the current project directory/vendor directory.
Govendor Installation
Go get-u-v Github.com/kardianos/govendor
Govendor Use
The vendor directory is automatically created #在GOPATH的src目录下创建项目 waetool #进入到项目目录 cd/home/gopath/src/waetool #初始化vendor目录
govendor init
#查看项目目录
[root@cc54425a waetool]# ls
vendor
#创建go项目文件
Main.go
# Automatically move the dependency pack used in Gopath to the vendor directory
#说明: If the local gopath does not have a dependency pack, go to get the corresponding dependency pack
# Automatically introducing items imported in Main.go code relies on the vendor folder
Govendor Add +external
#通过设置环境变量 go15vendorexperiment=1 Use the Vendor folder to build the file.
#可以选择 export go15vendorexperiment=1 or go15vendorexperiment=1 go build to perform compilation
export go15vendorexperiment=1
Other instruction Reference
# View your work.
Govendor List
# Look in what is using a package
Govendor list-v fmt
# 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".
# Update A package to latest, given any prior version constraint
Govendor fetch golang.org/x/net/context
# forma T your repository only
Govendor fmt +local
# builds everything in your repository only
Govendor install Al
# Test your repository only
Govendor test +local