douting1871 2016-05-07 00:19
浏览 216
已采纳

在Ubuntu上设置GOPATH-仍然出现错误

I have set following path on my ~/.bashrc file

export GOPATH=/usr/lib/go
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin

But when i installed ATOM IDE and i tried to install go-plus package, it tired to download something at the end and i got the error that

package github.com/nsf/gocode: cannot download, $GOPATH not set. For more details see: go help gopath

What I am doing wrong ? Here is my ubunt information as well.

Distributor ID: Ubuntu
Description:    Ubuntu 15.10
Release:    15.10
Codename:   wily

P.S

I have already tried setting my

export GOPATH=/home/<username/go
export PATH=$PATH:$GOPATH/bin
  • 写回答

2条回答 默认 最新

  • dtfo55908 2016-05-07 00:33
    关注

    Okay guys, I figured out the problem.

    https://github.com/joefitzgerald/go-plus/issues/386

    here it has been discussed. I will just copy it from that

    Linux folks, particularly those running Ubuntu. I believe I have reproduced your issues and I think they have to do with where you are setting your GOPATH and PATH.

    • ~/.profile: If you set them here, $GOPATH will be set in Atom when you launch Atom for the first time from the launcher in the toolbar

    • ~/.bashrc If you set them here, $GOPATH will be set in Atom when you launch Atom for the first time from the terminal Thus, to ensure GOPATH and PATH are set correctly regardless of how you launch Atom, you should put the following (or similar) in both ~/.profile and ~/.bashrc:

    export GOPATH=$HOME/work
    
    export PATH=$GOPATH/bin:/usr/local/go/bin:$PATH
    

    Obviously the above doesn't apply exactly if bash isn't your default shell, but I trust that if you're a user of a different shell, you can grok what I am saying above and apply the same principles to your particular environment.

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

报告相同问题?

悬赏问题

  • ¥15 图像信息库的建立与识别
  • ¥15 韩国网站购物,KG支付的支付回调如何解决
  • ¥15 workstation导入ovf文件,报错,怎么解决呢?
  • ¥15 关于#c语言#的问题:构成555单稳态触发器,采用LED指示灯延时时间,对延时时间进行测量并显示(如楼道声控延时灯)需要Proteus仿真图和C语言代码
  • ¥15 workstation加载centos进入emergency模式,查看日志报警如图,怎样解决呢?
  • ¥50 如何用单纯形法寻优不能精准找不到给定的参数,并联机构误差识别,给定误差有7个?matlab
  • ¥15 workstation加载centos进入emergency模式,查看日志报警如图,没有XFS,怎样解决呢?
  • ¥15 应用商店如何检测在架应用内容是否违规?
  • ¥15 Ubuntu系统配置PX4
  • ¥50 nw.js调用activex