douju2474 2016-01-22 01:13
浏览 127
已采纳

Go包将自我导入,并且无法在其中找到自己的GOPATH

Every once in awhile, I'll use a go package that has a go get like : go get github.com/<user>/aRepo and in its own import statement have import "github.com/<user>/aRepo". So it imports itself using a the "go gettable" path. Sometimes this works fine; however, sometimes I get

package github.com/<user>/aRepo
imports github.com/<user>/aRepo
imports github.com/<user>/aRepo: cannot find package "github.com/<user>/aRepo" in any of:
/usr/local/go/src/github.com/<user>/aRepo (from $GOROOT)
/home/me/go/src/github.com/<user>/aRepo (from $GOPATH)

I set my GOPATH with:

export GOPATH=$GOPATH:/home/me/go:`godep path`

It's very unclear as to why this would happen, any ideas as to why?

EDIT

my go env:

GOARCH="amd64"
GOBIN=""
GOCHAR="6"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH=":/home/vagrant/go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1"
  • 写回答

1条回答 默认 最新

  • doubaolan2842 2016-01-22 05:05
    关注

    So it turns out it was a permissions issue since I was using a vagrant box with a synced folder, vagrant set the entire path that synced folder created as 744 root:root. Therefore, I could not write to that folder as a non-root user, so that error message is actually coming from godep trying to install itself and not finding its src.

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

报告相同问题?

悬赏问题

  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 软件测试决策法疑问求解答
  • ¥15 win11 23H2删除推荐的项目,支持注册表等
  • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法
  • ¥15 qt6.6.3 基于百度云的语音识别 不会改
  • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
  • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
  • ¥20 测距传感器数据手册i2c