douchunji1885 2013-12-08 20:41
浏览 327
已采纳

go get中的“无法识别的导入路径”

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.

  • 写回答

9条回答 默认 最新

  • drctyr2869 2013-12-08 22:11
    关注

    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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(8条)

报告相同问题?

悬赏问题

  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?