2013-02-04 00:57
浏览 36


I know local imports should be avoided, however special circumstances demand it in this case. It's a private repo, and the heroku buildpack fails in the go get ./... phase when used with absolute urls, due to a missing private key on the server.

Now I get this error local import ".." in non-local package.

All import paths were changed to the local version so what remains that qualifies a package as "non-local"? How do I fix this?

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

我知道应该避免本地进口,但是在这种情况下需要特殊情况。 这是一个私有存储库,由于服务器上缺少私有密钥,当与绝对URL一起使用时,heroku buildpack在 go get ./...阶段失败。 \ n

现在我在非本地包中得到此错误 local import“ ..”

所有导入路径均已更改为本地版本 仍然有资格将软件包视为“非本地”软件包? 我该如何解决?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

3条回答 默认 最新

  • douzuqin3467
    douzuqin3467 2013-02-04 11:17

    I fixed it. The issue was that the root package was in $GOPATH/src/<host>/<user>/<package>. As soon as I moved the package to ~/Git/<package> the errors were gone (thus, "made it local").

    点赞 评论
  • douhuireng4407
    douhuireng4407 2013-02-04 01:45

    A local package import path is an absolute file system path or one beginning with ./ or ../. A non-local package import path is not a local package import path.


    点赞 评论
  • doujunchi1238
    doujunchi1238 2013-02-04 04:32

    peterSo is right. Looking at the code where that error message gets generated it would happen if the package being loaded didn't start with / ./ or ../ but it imported one that did. In the case of your issue there are several things that could cause it.

    1. go get caused a dependent package referenced with a non-local path to be build which then loaded in turn a local path.
    2. you are go getting a non-local package path that includes a local import.

    I think perhaps you should just fix the missing private key issue on the server rather than trying to use a local path.

    To properly debug I'd need to know what packages exactly that you were getting and what their transitive dependencies were.

    One last thing why are you using go get for local path installation (ie. go get ./...)? go install or go build are usually what you want in that case.

    点赞 评论