“无法识别的导入路径”与去得到 [英] "unrecognized import path" with go get
问题描述
我试图安装 web.go
,但运行去获取github.com/hoisie/web
返回
包bufio:无法识别的导入路径bufio
包字节:无法识别的导入路径字节
package crypto / rand:无法识别的导入路径crypto / rand
package crypto / sha1:无法识别的导入路径crypto / sha1
package crypto / tls:无法识别的导入路径crypto / tls
包编码/ base64:无法识别的导入路径encoding / base64
包编码/ binary:无法识别的导入路径encoding / binary
包编码/ json:无法识别的导入路径encoding / json
软件包错误:无法识别的导入路径错误
软件包fmt:无法识别的导入路径fmt
,并且这会持续一段时间,然后再返回其他任何内容。 go env
给我:
GOARCH =amd64
GOBIN =/ usr / local / go / bin
GOCHAR =6
GOEXE =
GOHOSTARCH =amd64
GOHOSTOS =linux
GOOS =linux
GOPATH =
GORACE =
GOROOT =/ home / me / go
GOTOOLDIR =/ home / me / go / pkg / tool / linux_amd64
TERM =dumb
CC =gcc
GOGCCFLAGS = - g -O2 -fPIC -m64 -pthread
CXX = g ++
CGO_ENABLED =1
如何安装 web.go
?使用 go获取
(而不是 go install
)是github页面上的README中的内容。 My Go版本 go版本go1.2 linux / amd64
。
问题涉及到一个无效 GOROOT
。
我认为你安装了Go <
因此,将 GOROOT
路径更改为 / usr / local / go / bin
。
看起来你的工作空间(GOPATH)位于<$ c
这可能会解决您的问题。
将此添加到底部您的bash个人资料,位于此处=> $ HOME / .profile
export GOROOT = / usr / local / go
export GOPATH = $ HOME / go
export PATH = $ PATH:$ GOROOT / bin
确保删除 GOROOT
的旧引用。
然后再次尝试安装web.go。
如果这样做不起作用,请让Ubuntu安装Go。
sudo apt-get install golang
视频教程:
http://www.youtube.com/watch?v=2PATwIfO5ag
I'm trying to install a web.go
, but running go get github.com/hoisie/web
returns
package bufio: unrecognized import path "bufio"
package bytes: unrecognized import path "bytes"
package crypto/rand: unrecognized import path "crypto/rand"
package crypto/sha1: unrecognized import path "crypto/sha1"
package crypto/tls: unrecognized import path "crypto/tls"
package encoding/base64: unrecognized import path "encoding/base64"
package encoding/binary: unrecognized import path "encoding/binary"
package encoding/json: unrecognized import path "encoding/json"
package errors: unrecognized import path "errors"
package fmt: unrecognized import path "fmt"
and this continues for a while with various packages, before returning nothing else. go env
gives me:
GOARCH="amd64"
GOBIN="/usr/local/go/bin"
GOCHAR="6"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH=""
GORACE=""
GOROOT="/home/me/go"
GOTOOLDIR="/home/me/go/pkg/tool/linux_amd64"
TERM="dumb"
CC="gcc"
GOGCCFLAGS="-g -O2 -fPIC -m64 -pthread"
CXX="g++"
CGO_ENABLED="1"
How can I install web.go
? Using go get
(rather than go install
) is what is in the README on the github page. My Go version is go version go1.2 linux/amd64
.
The issues are relating to an invalid GOROOT
.
I think you installed Go in /usr/local/go
.
So change your GOROOT
path to the value of /usr/local/go/bin
.
It seems that you meant to have your workspace (GOPATH) located at /home/me/go
.
This might fix your problem.
Add this to the bottom of your bash profile, located here => $HOME/.profile
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$PATH:$GOROOT/bin
Make sure to remove the old references of GOROOT
.
Then try installing web.go again.
If that doesn't work, then have Ubuntu install Go for you.
sudo apt-get install golang
Video tutorial: http://www.youtube.com/watch?v=2PATwIfO5ag
这篇关于“无法识别的导入路径”与去得到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!