使用go mod模式进行开发安装第三方包
go get github.com/oxequa/realize
提示
go: github.com/oxequa/realize upgrade => v2.0.2+incompatible go: finding module for package github.com/oxequa/interact go: finding module for package gopkg.in/urfave/cli.v2 go: finding module for package github.com/go-siris/siris/core/errors go: finding module for package github.com/labstack/echo/middleware go: finding module for package github.com/fatih/color go: finding module for package github.com/labstack/echo go: found github.com/oxequa/interact in github.com/oxequa/interact v0.0.0-20171114182912-f8fb5795b5d7 go: found gopkg.in/urfave/cli.v2 in gopkg.in/urfave/cli.v2 v2.3.0 go: found github.com/fatih/color in github.com/fatih/color v1.10.0 go: found github.com/go-siris/siris/core/errors in github.com/go-siris/siris v7.4.0+incompatible go: found github.com/labstack/echo in github.com/labstack/echo v3.3.10+incompatible 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
重点在这一段
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
在go.mod文件的require外面添加一段
replace gopkg.in/urfave/cli.v2 v2.3.0 => github.com/urfave/cli/v2 v2.3.0
就可以了
使用 replace 把 gopkg.in/urfave/cli.v2 包指向新的 github.com/urfave/cli/v2