简体   繁体   中英

How to fix gomod: `github.com/stretchrcom/testify@v1.4.0: parsing go.mod: unexpected module path “github.com/stretchr/testify”`

When I do a go mod tidy . I got the following error:

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

This error is due a package referring to testify before it was moved to github.com/stretchr/testify .

The solution is to add the following line in your 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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