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上的解决方案:
- 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.- 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.