Go-dependent management-Govendor

Source: Internet
Author: User

For a long time, Golang has no good management of external dependencies and can only look for dependencies from the $GOPATH. This makes it possible for different users to install the same project that may be externally acquired to a different version of the dependent library, and cannot compile dependent missing items when the network is not available.

The Govendor tool has been introduced since version 1.5, which puts the project-dependent external packages under the vendor directory under the project (in contrast to the Node_modules directory of Nodejs) and records the version of the dependent package through the Vendor.json file, which makes it easier for users to use relatively stable The dependency.

For Govendor, there are three types of packages: The package is organized locally (local), the traditional dependency package for the $GOPATH is external (external) dependent package, and the Govendor-managed dependency package in the vendor directory is Vendor package.

Specifically, the possible types of these packages are as follows:

Status abbreviation Status meaning
+local L Local package, which is the package organization of the project itself
+external E External package, which is managed $GOPATH, but not in the vendor directory
+vendor V has been managed by Govendor, i.e. in the vendor directory
+std S Packages in the standard library
+unused U Unused packages, which are wrapped in the vendor directory, but are not used by the project
+missing M The code references the dependent package, but the package does not find
+program P The main package, which means that you can compile to execute the file
+outside External packages and missing packages
+all All the Packages

The common commands are the following, formatted as Govendor command.

By specifying the package type, you can filter operations only on the specified package.

remove dependencies from Vendor management
command features
init Early Initialize Vendor directory
list list all dependent packages
Add Add package to Vendor directory such as Govendor add +external Add all external packages
Add pkg_path Add the specified dependency package to the vendor directory
update update the dependency package from the $GOPATH to the vendor directory
Remove
status list all missing, expired, and modified packages
fetch Add or update package to local vendor directory
sync Local presence Vendor.json pull dependency package, Match recorded version
get similar to  go get  directory, pull dependency package to Vendor directory

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.