【问题标题】:How to use go module as dependency in go dep project?如何在 go dep 项目中使用 go 模块作为依赖项?
【发布时间】:2019-05-12 17:01:47
【问题描述】:

我有 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 时,一切正常。

【问题讨论】:

    标签: go dependency-management package-managers go-modules godeps


    【解决方案1】:

    感谢您使用 Pion :)

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-06-27
      • 2021-07-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多