如何修复gomod:`github.com/stretchrcom/testify@v1.4.0:解析go.mod:意外的模块路径“ 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