Go mod graphql-go 的 Replace

如今在項目中大量的使用 graphql,但用的版本是3年前的版本。git

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

如今的url:github.com/graph-gophers/graphql-goui

升級成go mod以後出錯了,由於graphql的語法發生了變化。這時候有一個搞笑的問題,你須要找到3年前的那個版本。url

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 importsspa

github.com/neelance/graphql-go/errors: github.com/neelance/graphql-go@v0.0.0-20200207002730-8334863f2c8b: parsing go.mod:code

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

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

 
好吧 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
若是代碼導入錯誤的,就替換全部的代碼
相關文章
相關標籤/搜索