dounaoji2054
2017-06-23 17:11
浏览 542
已采纳

运行“ go get”时,GOPATH之外的目录没有安装位置,错误

Simple Go project, with a external dependence:

import (  
        "fmt"  
        "html"  
        "log"  
        "net/http"  
        "github.com/gorilla/mux"  
)

My path working fine for other tasks like run, build, etc.: GOPATH="/home/racar/go"

But when I try to get a external package with "go get" command, I got this error:

"go install: no install location for directory... outside GOPATH"

Edit: I have set my PATH in ~/.bashrc: export PATH=$PATH:$GOROOT/bin:$GOPATH/bin

图片转代码服务由CSDN问答提供 功能建议

具有外部依赖项的Simple Go项目:

  import  (
“ fmt” 
“ html” 
“ log” 
“ net / http” 
“ github.com/gorilla/mux” 
)
   
 \  n 

我的路径可以很好地用于其他任务,例如运行,构建等: GOPATH =“ / home / racar / go”

当我尝试使用“ go get”命令获取外部软件包时,出现以下错误:

“进行安装:在GOPATH之外没有目录的安装位置... “

编辑: 我已经在〜/ .bashrc中设置了我的PATH: export PATH = $ PATH:$ GOROOT / bin:$ GOPATH / bin

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • douti8321 2017-06-29 21:41
    已采纳

    According with this link: github.com/golang/go/wiki/SettingGOPATH

    Is needed to set GOBIN path in bash file: export GOBIN=$HOME/work/bin

    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题