疯子的自留地

当我老了,也一样写代码.不为别的,只为爱好!

glide get/update时报Error looking for testing解决方案

在使用glide管理go项目依赖包时,一旦我写了测试用例,再使用glide update/glide get xxx时就会出现下面的错误:

[WARN]  Unable to checkout testing
[ERROR] Error looking for testing: Cannot detect VCS
[ERROR] Failed to retrieve a list of test dependencies: Error resolving imports

很纳闷,testing包难道不是官方包?怎么还会说找不到呢?在Github上发现我并不孤单,于是在相关的issue下面回复了下, 后来发现原来是我自己的$GOPATH下面有一个testing的包,而这个包是我几年前初学golang时直接建立的文件夹,bingo,把testing这个文件夹重命名了一下,问题解决. 附上issue上的解决方案:

  1. check GOROOT before GOPATH in dependence.FindPkg (related to issue #577 )
    If there is "testing" project in GOPATH, pkg "testing" will be found in GOPATH success, "testing" and will be inserted into fetching list.

  2. only deal with first path on GOPATH, skip others
    If GOPATH has more than one paths, "GOPATH=/opt/gopkg:/home/someone/goprj" for example, trying to fetch own private project in goprj is strange. We should only fetch and vendor pkgs in first path of GOPATH.

本文基于"姓名标识-非商业性-相同方式分享 4.0国际"协议创作或转载,转载原创文章请注明来源于疯子的自留地,否则请勿转载或再转载,谢谢合作:)