举例
go get github.com/oxequa/realize
报错提示
...
go: github.com/oxequa/realize imports
gopkg.in/urfave/cli.v2: gopkg.in/urfave/cli.v2@v2.3.0: parsing go.mod:
module declares its path as: github.com/urfave/cli/v2
but was required as: gopkg.in/urfave/cli.v2
分析
依赖的第三方包使用了 github.com/urfave/cli/v2 ,但被解析成了使用 gopkg.in/urfave/cli.v2 。
解决
使用go mod提供的replace命令,把 gopkg.in/urfave/cli.v2 包指向新的 github.com/urfave/cli/v2
replace gopkg.in/urfave/cli.v2 v2.3.0 => github.com/urfave/cli/v2 v2.3.0