Go mod graphql-go 的 Replace

现在在项目中大量的使用 graphql,但用的版本是3年前的版本。

3年前包的url:github.com/neelance/graphql-go

现在的url:github.com/graph-gophers/graphql-go

升级成go mod之后出错了,因为graphql的语法发生了变化。这时候有一个搞笑的问题,你需要找到3年前的那个版本。

github.com/graph-gophers/graphql-go v0.0.0-20170406083916-01ab5128e53e
 
但是3年前的路径是 github.com/neelance/graphql-go,代码里都是这样使用的。
这时候go mod tidy,

go: github.com/graph-gophers/graphql-go imports

github.com/neelance/graphql-go/errors: github.com/neelance/[email protected]: parsing go.mod:

module declares its path as: github.com/graph-gophers/graphql-go

        but was required as: github.com/neelance/graphql-go

 
好吧 replace 吧
replace github.com/neelance/graphql-go => github.com/graph-gophers/graphql-go v0.0.0-20170406083916-01ab5128e53e

require github.com/neelance/graphql-go v0.0.0-00010101000000-000000000000
如果代码导入错误的,就替换所有的代码

猜你喜欢

转载自www.cnblogs.com/view85/p/12293390.html