【问题标题】:How to fix gomod: `github.com/stretchrcom/testify@v1.4.0: parsing go.mod: unexpected module path "github.com/stretchr/testify"`如何修复 gomod:`github.com/stretchrcom/testify@v1.4.0:解析 go.mod:意外的模块路径“github.com/stretchr/testify”`
【发布时间】:2019-10-10 09:07:07
【问题描述】:

当我执行go mod tidy 时。 我收到以下错误:

go: github.com/stretchrcom/testify@v1.4.0: parsing go.mod: unexpected module path "github.com/stretchr/testify"

【问题讨论】:

    标签: go go-modules


    【解决方案1】:

    此错误是由于在移动到 github.com/stretchr/testify 之前引用了 testify 的包。

    解决方案是在您的go.mod 中添加以下行:

    replace github.com/stretchrcom/testify v1.4.0 => github.com/stretchr/testify v1.4.0

    【讨论】:

      【解决方案2】:

      如果这是一个直接依赖项,那么建议将正确的依赖项直接添加到您的go.mod 文件中,即github.com/stretchr/testify v1.4.0

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2022-01-12
        • 2020-06-23
        • 2015-02-27
        相关资源
        最近更新 更多