我正在尝试解决 Orielly 一书中的 Decentralized Applications 中提供的示例。
go-ipfs
包似乎已经过时,新版本不能正常工作。所以我手动应对旧版本并尝试编译 go-kerala。
尽管某些文件夹存在于路径中,但我收到错误消息。
例如,
/home/rajkumar/go/src/github.com/ipfs/go-
ipfs/Godeps/_workspace/src/github.com/jbenet/go-base58(来自 $GOPATH)
在我手动复制旧版本文件后出现,但 go-get 命令仍然出错。
$go get -d github.com/llSourcell/kerala
package code.google.com/p/go.net/context: unrecognized import path
"code.google.com/p/go.net/context" (parse
https://code.google.com/p/go.net/context?go-get=1: no go-import meta
tags (meta tag github.com/golang/go did not match import path
code.google.com/p/go.net/context))
package github.com/ipfs/go-
ipfs/Godeps/_workspace/src/github.com/jbenet/go-base58: cannot find
package "github.com/ipfs/go-
ipfs/Godeps/_workspace/src/github.com/jbenet/go-base58" in any of:
/usr/local/go/src/github.com/ipfs/go-
ipfs/Godeps/_workspace/src/github.com/jbenet/go-base58 (from $GOROOT)
/home/rajkumar/go/src/github.com/ipfs/go-
ipfs/Godeps/_workspace/src/github.com/jbenet/go-base58 (from $GOPATH)
package github.com/ipfs/go-
ipfs/Godeps/_workspace/src/github.com/jbenet/go-ctxgroup: cannot find
package "github.com/ipfs/go-
ipfs/Godeps/_workspace/src/github.com/jbenet/go-ctxgroup" in any of:
/usr/local/go/src/github.com/ipfs/go-
ipfs/Godeps/_workspace/src/github.com/jbenet/go-ctxgroup (from $GOROOT)
/home/rajkumar/go/src/github.com/ipfs/go-
ipfs/Godeps/_workspace/src/github.com/jbenet/go-ctxgroup (from $GOPATH)
package github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore: cannot find
package "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore" in any of:
/usr/local/go/src/github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore (from $GOROOT)
/home/rajkumar/go/src/github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore (from $GOPATH)
package github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore/sync: cannot find package "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore/sync" in any of:
/usr/local/go/src/github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore/sync (from $GOROOT)
/home/rajkumar/go/src/github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore/sync (from $GOPATH)
我是否缺少任何解决错误的步骤。
最佳答案
您复制了无法编译的过时代码。
code.google.com/p/go.net/context
code.google.com 已关闭,这是无法再使用的旧导入路径。该错误告诉您出了什么问题,该路径无法导入,因为它不存在(尝试在浏览器中访问它)。
您可能会花很多时间修复旧的导入,结果却发现包已经更改并且无法再编译,所以我建议从最新版本开始并联系 github 的作者。 github 上的 com/ipfs/go-ipfs,或者选择另一个包来使用。
关于戈兰错误: `cannot find package` when running go get,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46375642/