Use of the Go Language dependency management tool Govendor

Source: Internet
Author: User
Tags pack

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




Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.