使用go mod模式进行开发安装第三方包冲突失败解决

举例

go get github.com/oxequa/realize

报错提示

...
go: github.com/oxequa/realize imports
        gopkg.in/urfave/cli.v2: gopkg.in/urfave/[email protected]: 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

你可能感兴趣的:(GO,golang,后端)