Godep with local packages

回眸只為那壹抹淺笑 提交于 2019-12-11 03:26:55

问题


I have a repository that looks like this:

src
|
|--myplace
   |--myprojectRepo
      |--someCmd
      |      main.go
      |--somePackage
      |      package.go

I'm trying to use Godeps to manage dependencies. However, when I run godep save inside of the someCmd folder, it copies not just the external code into the godep _workspace, but also the somePackage code into the godep _workspace.

Is there anyway to stop godep from copying code that is in the same repository into its _workspace?

The main ugliness that I see with this is that now there are two versions of somePackage.go. One in the somePackage directory and one in the godeps/_workspace... directory. And if I make a change to somePackage, I have to rerun godep inside of someCmd in order to have those changes pulled in.


回答1:


when I run godep save inside of the someCmd folder

Godep will vendor everything that is not a sub-directory, it does not goes up to your repository's root.

You have to run godep save ./... from the root of your project : it will save all external dependencies for your project in one place.

As @JimB said, anyway people are gonna be pulling the whole repository at once, not sub-packages by sub-packages. And they should run godep restore from the repository's root too.



来源:https://stackoverflow.com/questions/32589511/godep-with-local-packages

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!