douzheren3349
2018-08-16 16:28
浏览 125
已采纳

使用golang dep从同一个github源获得不同的软件包版本

I'm attempting to convert a project from govendor to dep. However, I'm finding one limitation in dep to make this impossible. In govendor, in the vendor.json file, I can have different packages from the same source have different revision hashes. Like this, for example:

{
    "checksumSHA1": "iYT7abLMy0Vfyy8nwoDZYirLrI4=",
    "path": "github.com/docker/docker/api/types",
    "revision": "deed26f7f0f9a9d279b8ac99389f204d9063d1a4",
    "revisionTime": "2018-03-29T10:06:29Z"
},
{
    "checksumSHA1": "jVJDbe0IcyjoKc2xbohwzQr+FF0=",
    "path": "github.com/docker/docker/api/types/blkiodev",
    "revision": "88c0317e23449d6ff730a1073f240586cbdfd4ba",
    "revisionTime": "2017-08-23T07:13:08Z"
},

However, when I solve this with dep init, the final .lock file seems to have picked the latest version:

[[projects]]
digest = "1:3101683c3a63814ac8fe12a61fa01b728340f647c484d71573a31f041a68e7bc"
name = "github.com/docker/docker"
packages = [
    "api/types",
    "api/types/blkiodev",
]
pruneopts = "UT"
revision = "deed26f7f0f9a9d279b8ac99389f204d9063d1a4"

Unfortunately, having every package under github.com/docker/docker at the same revision doesn't work for us at all. Trying to make them all one revision brings up an entire cascade of revision changes to other transitive packages that we simply cannot tolerate at this time. (This example is pruned down, we have a lot of packages under github.com/docker/docker, and those packages are pidgeon-holed into three or four different versions).

So the question is, can dep handle having packages from the same "name" with different revisions? If so, are we stuck forever with govendor? That would make me personally unhappy because govendor is... uh... challenging... (it's probably how we got into this bad place)

Thanks in advance for all the help!

图片转代码服务由CSDN问答提供 功能建议

我正在尝试将项目从govendor转换为dep。 但是,我发现dep中有一个限制使之不可能。 在govendor中,在vendor.json文件中,我可以从同一来源获得不同的程序包,并使用不同的修订哈希值。 像这样,例如:

  {
“ checksumSHA1”:“ iYT7abLMy0Vfyy8nwoDZYirLrI4 =”,
“ path”:“ github.com/docker/docker/api/types  “,
”修订“:” deed26f7f0f9a9d279b8ac99389f204d9063d1a4“,
”修订时间“:” 2018-03-29T10:06:29Z“ 
},
 {
” checksumSHA1“:” jVJDbe0IcyjoKc2xbohwzQr +  n“路径”:“ github.com/docker/docker/api/types/blkiodev”,
“修订”:“ 88c0317e23449d6ff730a1073f240586cbdfd4ba”,
“修订时间”:“ 2017-08-23T07:13:08Z” 
  },
   
 
 

但是,当我使用dep init解决此问题时,最终的.lock文件似乎选择了最新版本:

  [[项目]] 
digest =“ 1:3101683c3a63814ac8fe12a61fa01b728340f647c484d71573a31f041a68e7bc” 
name =“ github.com/docker/docker"
packages = [
” api / types“,
” api / types /  blkiodev“,
] 
pruneopts =” UT“ 
revision =” deed26f7f0f9a9d279b8ac99389f204d9063d1a4“ 
   
 
 

不幸的是,每个软件包都位于github.com/docker/docker下 相同的修订 根本不为我们工作。 试图使它们全部成为一个修订版本,从而将整个修订版本引入了我们目前无法容忍的其他可传递程序包。 (该示例被删减,我们在github.com/docker/docker下有很多软件包,并且这些软件包被皮格孔分成三个或四个不同的版本。)

问题是,Dep可以处理具有相同“名称”且版本不同的软件包吗? 如果是这样,我们会永远与govendor保持联系吗? 那会让我个人不高兴,因为govendor是...呃...具有挑战性...(这可能是我们进入这个糟糕地方的方式)

在此先感谢所有帮助!

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • douniwan_0025 2018-08-16 18:17
    已采纳

    So the question is, can dep handle having packages from the same "name" with different revisions?

    No.

    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题