英文:
"go get google.golang.org/grpc" failing: unrecognized import path
问题
所以我正在尝试在我的Raspberry 3/Raspbian系统上使用"go get"安装我的Go应用程序的依赖项,但在尝试安装Go的gRPC时遇到了以下问题:
[pi@raspberrypi-1 camera-service] 17:32:28 % go get google.golang.org/grpc
package google.golang.org/grpc: unrecognized import path "google.golang.org/grpc" (https fetch: Get https://google.golang.org/grpc?go-get=1: dial tcp: lookup google.golang.org on 192.168.1.1:53: read udp 192.168.1.64:33524->192.168.1.1:53: i/o timeout)
与此同时,我可以成功安装其他(非google.golang.org)的依赖项(例如go get github.com/asaskevich/EventBus)。
对我来说,这看起来像是一个DNS问题--192.168.1.1是我的路由器,192.168.1.64是我的RPi。然而,我可以成功解析该地址:
[pi@raspberrypi-1 camera-service] 17:32:52 % host google.golang.org
google.golang.org is an alias for golang.org.
golang.org has address 216.58.209.145
golang.org has IPv6 address 2a00:1450:400f:804::2011
golang.org mail is handled by 1 aspmx.l.google.com.
golang.org mail is handled by 2 alt2.aspmx.l.google.com.
golang.org mail is handled by 2 alt1.aspmx.l.google.com.
golang.org mail is handled by 2 alt3.aspmx.l.google.com.
这很奇怪。而且我已经在另一个系统上安装了相同的包,没有问题。
我的环境是:
- Go 1.8.3,从预编译的ARM6二进制文件安装
- export GOROOT="/usr/local/go"
- export GOPATH="/home/pi/go"
英文:
So I am trying to install my Go app's dependencies on my Raspberry 3/Raspbian system with "go get" and running into the following when trying to install gRPC for Go:
[pi@raspberrypi-1 camera-service] 17:32:28 % go get google.golang.org/grpc
package google.golang.org/grpc: unrecognized import path "google.golang.org/grpc" (https fetch: Get https://google.golang.org/grpc?go-get=1: dial tcp: lookup google.golang.org on 192.168.1.1:53: read udp 192.168.1.64:33524->192.168.1.1:53: i/o timeout)
Meanwhile I am able to install other (non-google.golang.org) dependencies (for example go get github.com/asaskevich/EventBus) just fine.
To me this looks a DNS problem -- 192.168.1.1 is my router, 192.168.1.64 is my RPi. However I can resolve the address just fine:
[pi@raspberrypi-1 camera-service] 17:32:52 % host google.golang.org
google.golang.org is an alias for golang.org.
golang.org has address 216.58.209.145
golang.org has IPv6 address 2a00:1450:400f:804::2011
golang.org mail is handled by 1 aspmx.l.google.com.
golang.org mail is handled by 2 alt2.aspmx.l.google.com.
golang.org mail is handled by 2 alt1.aspmx.l.google.com.
golang.org mail is handled by 2 alt3.aspmx.l.google.com.
This is weird. Also I have installed the same packages on another system np.
My environment is
- Go 1.8.3, installed from prebuilt ARM6 binary
- export GOROOT="/usr/local/go"
- export GOPATH="/home/pi/go"
答案1
得分: 3
这可能是因为你在使用Go的内置DNS解析器,而不是委托给系统的名称解析器。在构建gRPC时,你是否设置了CGO_ENABLED=1
?你可以通过在获取gRPC时设置GODEBUG=netdns=cgo
来检查:
$ GODEBUG=netdns=cgo go get google.golang.org/grpc
英文:
This may be because you are using the built in DNS resolver in Go, rather than delegating to the system name resolver. When you built gRPC, did you set CGO_ENABLED=1
? You can check by setting GODEBUG=netdns=cgo
when getting gRPC:
$ GODEBUG=netdns=cgo go get google.golang.org/grpc
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论