doulianxi0587
2019-05-12 17:01
浏览 103
已采纳

如何在go dep项目中将go模块用作依赖项?

I have Go dep project. I want to use go module as dependency. For example. I need this one https://github.com/pion/webrtc.

So, I try to declare the dependency like this, in Gopkg.toml:

[[constraint]]
  name = "github.com/pion/webrtc"
  revision = "6a0b7020b1724dcb302ddfadab0c80fabc144c97"

When I do dep ensure, I got errors:

Solving failure: No versions of github.com/pion/webrtc met constraints:
        6a0b7020b1724dcb302ddfadab0c80fabc144c97: "github.com/pion/webrtc" imports "github.com/pion/webrtc/v2/pkg/rtcerr", which con
tains malformed code: no package exists at "github.com/pion/webrtc/v2/pkg/rtcerr"
        v2.0.14: Could not introduce github.com/pion/webrtc@v2.0.14, as it is not allowed by constraint 6a0b7020b1724dcb302ddfadab0c
80fabc144c97 from project ***.
        v2.0.13: Could not introduce github.com/pion/webrtc@v2.0.13, as it is not allowed by constraint 6a0b7020b1724dcb302ddfadab0c
80fabc144c97 from project ***.

It seems, that the problem is connected with 2 version of library. When it was 1, everything works fine.

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

我有Go dep 项目。 我想使用go模块作为依赖项。 例如。 我需要这个 https://github.com/pion/webrtc

因此,我尝试在 Gopkg中声明这种依赖性。 toml

  [[约束]] 
 name =“ github.com/pion/webrtc"
版本=” 6a0b7020b1724dc​​b302ddfadab0c80fabc144c97“ 
   
 
 

当我做 dep sure 时,出现错误:

 解决失败:没有github版本 .com / pion / webrtc满足约束条件:
 6a0b7020b1724dc​​b302ddfadab0c80fabc144c97:“ github.com/pion/webrtc”导入“ github.com/pion/webrtc/v2/pkg/rtcerr”,其中包含格式错误的代码:在该位置不存在任何软件包 “ github.com/pion/webrtc/v2/pkg/rtcerr”
 v2.0.14:无法引入github.com/pion/webrtc@v2.0.14,因为项目**的约束6a0b7020b1724dc​​b302ddfadab0c 
80fabc144c97不允许这样做 *。
 v2.0.13:无法介绍github.com/pion  /webrtc@v2.0.13,因为项目***的约束6a0b7020b1724dc​​b302ddfadab0c 
80fabc144c97不允许这样做。
   
 
 

看来,问题与< 库的em> 2版本。 当它是 1 时,一切正常。

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • doumangzhen7204 2019-05-12 23:01
    已采纳

    Thanks for using Pion :)

    We had the same issue opened on Pion WebRTC issue tracker. There is a PR to fix dep for this case.

    If possible I would switch to modules though, but in the meantime hopefully using this patched version of dep should help!

    打赏 评论

相关推荐 更多相似问题