我关注了this guide在 Ubuntu 16.04 上安装 Go。但是,当我按照 installation instructions对于 Go 应用程序 (go get github.com/src-d/enry/cmd/enry
),我收到以下错误:
package github.com/src-d/enry/v2: cannot find package "github.com/src-d/enry/v2" in any of:
/usr/local/go/src/github.com/src-d/enry/v2 (from $GOROOT)
/root/work/src/github.com/src-d/enry/v2 (from $GOPATH)
package github.com/src-d/enry/v2/data: cannot find package "github.com/src-d/enry/v2/data" in any of:
/usr/local/go/src/github.com/src-d/enry/v2/data (from $GOROOT)
/root/work/src/github.com/src-d/enry/v2/data (from $GOPATH)
这是 go env
的输出:
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/root/work"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GO15VENDOREXPERIMENT="1"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1"
我做错了什么?
注意:我对如何使用 Go 进行编程完全是零知识,我只是想安装一个 CLI 应用程序。
最佳答案
检查$GOPATH的可写权限。当你设置时,它在/root
关于Golang `go get` - 找不到任何包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56534343/