go - 如何在go dep项目中使用go module作为依赖?

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

我有 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 :)

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

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

关于go - 如何在go dep项目中使用go module作为依赖?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56101497/

相关文章:

api - Web api 将名称和密码设置为 request.BasicAuth

dependencies - 如何在gradle中的一条指令中将多个项目依赖项添加到配置中

c++ - 通过C++判断某个程序是否安装在Linux中

R 全局安装包

json - 无法将 json 解码为从其他包导出的结构

go - 如何修复m [0] == nil {},以便将其计入err

android - 在 build.gradle 中指定 Maven 依赖项不起作用

c++ - 在 C++ 中自动依赖管理的最干净的方法

centos - 如何在 CentOS 上安装 libmemcached

go - 如何设置CORS设置