繁体   English   中英

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

[英]How to use go module as dependency in go dep project?

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

所以,我尝试在Gopkg.toml中声明这样的依赖:

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

当我确定dep ensure ,我遇到了错误:

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 ***.

看来,问题与2版本的库有关。 当它为1时 ,一切正常。

感谢您使用Pion :)

我们在Pion WebRTC问题跟踪器上打开了相同的问题 对于这种情况,有一个PR来修复dep。

如果可能的话,我会切换到模块,但同时希望使用这个修补版本的dep应该有帮助!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM