What is go vendor

go vendor management packs are introduced golang dependent manner, the introduction of version 1.5, 1.6 formal introduction.

The basic principle
in fact, will depend on the package, especially outside of the package, copied to the vendor directory under the current project, so go build time, go look for dependencies priority from the vendor directory.

Advantage of
vendor directory will depend on the external bag into the project, it can be directly compiled directly in other machines, without having to go to build the compiler environment outside the package, one by one go get access to external package. Of course, you can also directly copy the entire source code under third-party packages GOPATH over the same vendor also played a role.
In addition, to prevent the external version of the package go get re-pulling and expectations of possible inconsistencies, resulting in compilation error problem.

Drawback
when you want to upgrade dependencies, you can manually upgrade (re-copy the source code dependencies after the upgrade).

Solution
is a third-party package: govendor
https://github.com/kardianos/govendor
govendor recorded version vendor information package, supports a similar way to go get updated vendor inside the package
---------- ------
Disclaimer: this article is the original article CSDN bloggers "lazy Xiaoda Song", and follow CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
Original link: https: //blog.csdn.net/mythest/article/details/90298342

Guess you like

Origin www.cnblogs.com/ExMan/p/11431483.html