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
CONSTRAINT
is a limited version of GOPKG.TOML;
VERSION
is the version in the current vendor;
REVISION
is the revision number in the current vendor;
LATEST
to 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