Godep与本地包 [英] Godep with local packages

查看:115
本文介绍了Godep与本地包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个如下所示的存储库:

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

我正在尝试使用Godeps来管理依赖关系。但是,当我在 someCmd 文件夹中运行 godep save 时,它不仅将外部代码复制到godep _workspace ,还有 somePackage 代码到godep _workspace 中。



有没有办法阻止godep将同一个存储库中的代码复制到它的 _workspace



我看到的主要丑陋是,现在有两个版本的 somePackage.go 。一个在 somePackage 目录中,另一个在 godeps / _workspace ... 目录中。如果我对 somePackage 进行了更改,我必须在 someCmd 内重新运行godep以便使这些更改

解决方案


当我运行godep保存在someCmd文件夹内时


Godep将供应所有不是子目录的所有内容,它不会上传到您的存储库的根目录。



您必须从项目根目录运行 godep save ./... :它会保存您的所有外部依赖项项目在一个地方。

正如@JimB所说,无论如何人们会一次拉动整个存储库,而不是通过子包打包子包。他们应该从版本库的根目录运行 godep restore


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.

解决方案

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.

这篇关于Godep与本地包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆