Golang use of official tools DEP

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.

First, install the article

1. Download release version. Open page https://github.com/golang/dep/releases, download the latest Dep-windows-amd64.exe
2. Put Dep-windows-amd64.exe into Gopath/bin, change the name to DEP

Ii. use of the article

Initialization

1. Switch to the project directorycd %GOPATH%/src/github.com/xxx/dep-demo
2. Initializationdep init

Add to

Pre-Add to Vendor
dep ensure -add github.com/foo/bar github.com/baz/quux

Update

dep ensure -update

Synchronous

Four cases: Introduction package, removal package, gopkg.toml rule modification, uncertainty in engineering
dep ensure

View status

Run
dep status
Results explained
CONSTRAINTis a limited version of GOPKG.TOML;
VERSIONis the version in the current vendor;
REVISIONis the revision number in the current vendor;
LATESTto CONSTRAINT qualify the latest version of GitHub to meet the requirements.

Modify a qualified version and synchronize

Modify the Gopkg.toml CONSTRAINT , if LATEST it is lower than the current version of vendor, then run dep ensure , the version of vendor down to meet the latest version of the requirements;
If you make the LATEST version above vendor, the dep ensure version in vendor will not change after running, and you can use dep ensure -update update vendor to LATEST version.

limiting version meaning

=: 等于!=: 不等于>: 大于<: 小于>=: 大于或等于<=: 小于或等于-: 文字范围。 如: 1.2 - 1.4.5相当于>= 1.2, <= 1.4.5~: 次版本号范围。如: ~1.2.3相当于>= 1.2.3, < 1.3.0^: 主版本号范围。特别说明:前面没有任何符号相当于^。如: ^1.2.3相当于>= 1.2.3, < 2.0.0,1.2.3相当于^1.2.3。[xX*]: 通配符. 如: 1.2.x相当于>= 1.2.0, < 1.3.0

Special Note: ^ Start from the left non-zero

^1.2.3 means 1.2.3 <= X < 2.0.0^0.2.3 means 0.2.3 <= X < 0.3.0^0.0.3 means 0.0.3 <= X < 0.1.0

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.