doureng6738 2016-12-15 22:34
浏览 271
已采纳

发出`go install`时出错

I'm in my go root path and I get error the following errors when I perform the go install command...

main.go:4:2: cannot find package "fmt" in any of:
    /usr/lib/go-1.6/bin/src/fmt (from $GOROOT)
    /home/rbtlong/go/src/fmt (from $GOPATH)
main.go:6:2: cannot find package "io/ioutil" in any of:
    /usr/lib/go-1.6/bin/src/io/ioutil (from $GOROOT)
    /home/rbtlong/go/src/io/ioutil (from $GOPATH)
main.go:5:2: cannot find package "net/http" in any of:
    /usr/lib/go-1.6/bin/src/net/http (from $GOROOT)
    /home/rbtlong/go/src/net/http (from $GOPATH)
package rbtlong.com
    imports runtime: cannot find package "runtime" in any of:
    /usr/lib/go-1.6/bin/src/runtime (from $GOROOT)
    /home/rbtlong/go/src/runtime (from $GOPATH)

I have tried unsetting the GOROOT, but it doesn't seem to work.

  • 写回答

3条回答 默认 最新

  • douniang3866 2016-12-16 00:43
    关注

    apparently, the definition was defined in $HOME/.bashrc after removing the definition for GOPATH and GOROOT, then manually removing the folder at /usr/lib/go-1.6 then reinstalling it using the instructions here https://golang.org/doc/install#install then setting the PATH and GOPATH by editing $HOME/.profile:

    PATH="[...]:/usr/local/go/bin[...]"

    export GOPATH="$HOME/go"

    it appears to be working now...

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

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器