我需要将此提交拉入我的Go项目。
我尝试了多个版本的go.mod
:
...
require (
github.com/libp2p/go-libp2p-core@v0.0.7-0.20190626134135-aca080dccfc2
// and...
github.com/libp2p/go-libp2p-core v0.0.0-20190626-aca080dccfc2c9933df66baafe6cf9cc4f429825
)
...
无论是哪种情况,在运行$ go build
时都会导致错误:
$ go build
go: finding github.com/libp2p/go-libp2p-core v0.0.0-20190626-aca080dccfc2c9933df66baafe6cf9cc4f429825
go: finding github.com/libp2p/go-libp2p-core v0.0.7-0.20190626134135-aca080dccfc2
go: github.com/libp2p/go-libp2p-core@v0.0.0-20190626-aca080dccfc2c9933df66baafe6cf9cc4f429825: unknown revision v0.0.0-20190626-aca080dccfc2c9933df66baafe6cf9cc4f429825
go: github.com/libp2p/go-libp2p-core@v0.0.7-0.20190626134135-aca080dccfc2: unknown revision aca080dccfc2
go: error loading module requirements
Go getting也不起作用:
$ go get github.com/libp2p/go-libp2p-core@aca080dccfc2c9933df66baafe6cf9cc4f429825
go: finding github.com/libp2p/go-libp2p-core v0.0.7-0.20190626134135-aca080dccfc2 go: github.com/libp2p/go-libp2p-core@v0.0.7-0.20190626134135-aca080dccfc2: unknown revision aca080dccfc2
go: error loading module requirements
@JimB指出,那个哈希值没有合并而是被重新派生了。因此我试图用一个新的哈希值来替换它,但仍然在尝试获取旧的哈希值?
$ go get github.com/libp2p/go-libp2p-core@v0.2.1-0.20190802003216-436d707f7cd0
go: finding github.com/libp2p/go-libp2p-core v0.0.7-0.20190626134135-aca080dccfc2
go: github.com/libp2p/go-libp2p-core@v0.0.7-0.20190626134135-aca080dccfc2: unknown revision aca080dccfc2
go: error loading module requirements
go.mod
文件里还有无效的吗?也许你在go.sum
里存储了一些东西?不要试图自己创建伪版本字符串(你的go.mod
行都不正确)。如果你想要一个特定的提交或分支,请使用go get
直接获取它。 - JimB