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 Matlab问题解答有两个问题
  • ¥50 Oracle Kubernetes服务器集群主节点无法访问,工作节点可以访问
  • ¥15 LCD12864中文显示
  • ¥15 在使用CH341SER.EXE时不小心把所有驱动文件删除了怎么解决
  • ¥15 gsoap生成onvif框架
  • ¥15 有关sql server business intellige安装,包括SSDT、SSMS。
  • ¥15 stm32的can接口不能收发数据
  • ¥15 目标检测算法移植到arm开发板
  • ¥15 利用JD51设计温度报警系统
  • ¥15 快手联盟怎么快速的跑出建立模型