golang错误:`运行go get时找不到包`

时间:2017-09-23 03:10:12

标签: go

我正在尝试解决Orielly出版的“Decentrallized Applications”中提供的示例。

go-ipfs包似乎已过时,新版本无法正常运行。所以我手动处理旧版本并尝试编译go-kerala。

尽管路径中存在一些文件夹,但我收到错误。

例如, 我手动复制旧版本文件后出现/home/rajkumar/go/src/github.com/ipfs/go- ipfs/Godeps/_workspace/src/github.com/jbenet/go-base58 (from $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)

我是否缺少任何解决错误的步骤。

1 个答案:

答案 0 :(得分:2)

您已复制过时的代码,但不会编译。

code.google.com/p/go.net/context

code.google.com已关闭,这是一个无法再使用的旧导入路径。该错误告诉您出错了什么,该路径无法导入,因为它不存在(尝试在浏览器中访问它)。

您可以尝试花费大量时间来修复旧的导入,但却发现无论如何都要更改软件包并且不再编译,所以我建议从最新版本开始并联系作者github上的github.com/ipfs/go-ipfs,或者选择另一个包来使用。