Go mod常见问题
简介Go mod常见问题
replace问题
在安装包的时候出现:
E:\go\src\rpc\test>go get gopkg.in/russross/blackfriday.v2
go: finding gopkg.in/russross/blackfriday.v2 v2.0.1
go get gopkg.in/russross/blackfriday.v2: gopkg.in/russross/blackfriday.v2@v2.0.1: invalid version: go.mod has non-....v2 module path "github.com/russross/blackfriday/v2" at revision v2.0.1
这里需要观察对应各自的路径和版本号:
- gopkg.in/russross/blackfriday.v2 v2.0.1
- github.com/russross/blackfriday/v2 v2.0.1
根据上面的两个路径,需要在go.mod最后一行添加:
replace gopkg.in/russross/blackfriday.v2 v2.0.1 => github.com/russross/blackfriday/v2 v2.0.1