【发布时间】: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
当我执行go mod tidy 时。
我收到以下错误:
go: github.com/stretchrcom/testify@v1.4.0: parsing go.mod: unexpected module path "github.com/stretchr/testify"
【问题讨论】:
标签: go go-modules
此错误是由于在移动到 github.com/stretchr/testify 之前引用了 testify 的包。
解决方案是在您的go.mod 中添加以下行:
replace github.com/stretchrcom/testify v1.4.0 => github.com/stretchr/testify v1.4.0
【讨论】:
如果这是一个直接依赖项,那么建议将正确的依赖项直接添加到您的go.mod 文件中,即github.com/stretchr/testify v1.4.0
【讨论】: