Go1.5之后有一些比较重要的改动,其中包含Vendoring
的支持,本文从使用和源码实现整理了一些备忘录,难免有疏漏,各位看官多指教。
没有引入Vendoring
机制时,Go项目组织主要有两种方案:
- 直接把项目放到
GOPATH
下面[详见: 附录1] - 项目放到
GOPATH
外,修改GOPATH
来使用Go Command[详见: 附录2]
第三方依赖管理的灵活性和便捷性要求Go加入一种新机制,在不打破现有GOPATH假设的情况下,扩展GOPATH的package
查找能力,这就是本文中介绍的Vendoring机制.