dongyan9950 2013-11-08 08:45
浏览 170
已采纳

GOPATH环境变量未设置

I'm trying to install the Oracle Driver for Go (go-oci8) following these instructions

The problem I'm facing is with the $GOPATH environment variable. When I execute the command:

sudo go get github.com/mattn/go-oci8

I get the error :

cannot download, $GOPATH not set. For more details see: go help gopath

However, I have the GOPATH properly set. My environment looks like this:

env | grep GO

GOARCH=amd64
GOROOT=/usr/local/go
GOOS=linux
GOPATH=/home/myuser/go/

ls $GOPATH
bin pkg src

I've found a similar post but the solution does not apply to my case.

  • 写回答

1条回答 默认 最新

  • doubiao7267 2013-11-08 16:53
    关注

    Sudo won't honor all your ENV variables for some very good security reasons.

    The simplest way to fix this is /bin/env

    sudo /bin/env GOPATH=/home/myuser/go go get <stuff>
    

    But you don't need to do that, you really shouldn't need root to write to GOPATH, only GOROOT.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 Python时间序列如何拟合疏系数模型
  • ¥15 求学软件的前人们指明方向🥺
  • ¥50 如何增强飞上天的树莓派的热点信号强度,以使得笔记本可以在地面实现远程桌面连接
  • ¥20 双层网络上信息-疾病传播
  • ¥50 paddlepaddle pinn
  • ¥20 idea运行测试代码报错问题
  • ¥15 网络监控:网络故障告警通知
  • ¥15 django项目运行报编码错误
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services