去得到->无法下载,/home/azhukov/go是GOROOT,而不是GOPATH [英] go get -> cannot download, /home/azhukov/go is a GOROOT, not a GOPATH

查看:80
本文介绍了去得到->无法下载,/home/azhukov/go是GOROOT,而不是GOPATH的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

美好的一天!我正在尝试在Google Cloud中安装gb(go的供应商工具). 我尝试go get,但失败了:

Good day! I am trying to install gb (vendoring tool for go) in Google Cloud. I try go get and it fails:

azhukov@gce-machine:~$ go get -v github.com/constabulary/gb/...
package github.com/pkg/errors: cannot download, /home/azhukov/go is a GOROOT, not a GOPATH. For more details see: 'go help gopath'

这是env:

azhukov@gce-machine:~$ echo $GOPATH, $GOROOT, $PATH
/home/azhukov/go, , /usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/local/go/bin:/home/azhukov/go/bin

开始版本:

azhukov@gce-machine:~$ go version
go version go1.8 linux/amd64

转到环境:

azhukov@gce-machine:~$ go env
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/azhukov/go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build477416510=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"

对我来说,一切看起来都很好,我不明白为什么会得到这样的错误.这是反逻辑的.

To me everything looks fine, I don't get why would go get return such error. It is counter-logical.

推荐答案

此错误是由go工具在GOPATH中检测到Go安装引起的.这不是在告诉您您的GOPATH是 the GOROOT(这是一条不同的消息),而是在告诉您的GOPATH像是 a GOROOT.

This error is caused by the go tool detecting a Go installation in your GOPATH. It's not telling you that your GOPATH is the GOROOT (that's a different message), it's telling your GOPATH looks like a GOROOT.

清理您的GOPATH并再次运行go get将修复该错误.

Cleaning out your GOPATH and running go get again will fix the error.

这篇关于去得到->无法下载,/home/azhukov/go是GOROOT,而不是GOPATH的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆