douqiaosu0280 2013-06-04 04:12
浏览 155

“安装”尝试安装到/ usr / lib / go而不是我的GOPATH。 没有权限

I have had some difficulties getting Go up and running correctly on Linux Mint 14. I have a folder ($HOME/develop/gocode) with bin, pkg and src folders as my GOPATH and have the GOPATH environment variable set properly there. I tried installing a certain github repository using go get (https://github.com/jbarham/primegen.go) but Go gave me the error: stat github.com/jbarham/primegen.go: no such file or directory (I think because the repository ends in .go.) Fine, I just cloned it manually, but then when I try to go install one of two executables in that repository (neither one works, but I tried installing primespeed first) I get the following error:

$ cd $GOPATH/src/github.com/jbarham/primegen.go/primespeed
$ go install
go install github.com/jbarham/primegen.go: mkdir /usr/lib/go/pkg/linux_amd64/github.com: permission denied

Why is go trying to install the package there? I've explicitly set my GOPATH variable, and yet it is trying to install packages to /usr/local instead.

I'm not sure if it will help, but here is some other output regarding version and environment:

$ go env
GOROOT="/usr/lib/go"
GOBIN=""
GOARCH="amd64"
GOCHAR="6"
GOOS="linux"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GOGCCFLAGS="-g -O2 -fPIC -m64 -pthread"
CGO_ENABLED="1"
$ go version
go version go1.0.2
  • 写回答

3条回答 默认 最新

  • dongrou2920 2013-06-04 06:15
    关注
    1. Your GOPATH is probably not exported.
    2. Yes, repositories having a .go extension are not 'go gettable'.

    Ad 1. (better put into .bashrc or equivalent):

    $ export GOPATH=$HOME # just an example
    

    Ad 2. (better raise an issue about the nonsensical repository name):

    $ mkdir -p $GOPATH/src/github.com/jbarham
    $ cd $GOPATH/src/github.com/jbarham
    $ git clone https://github.com/jbarham/primegen.go.git
    $ cd primegen.go
    $ go install
    
    评论

报告相同问题?

悬赏问题

  • ¥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#的问题,如何解决?