douxing9228 2017-11-08 18:39
浏览 117
已采纳

无法识别的导入路径(导入路径不是以主机名开头)

I've installed go as per the custom installation clause of the installation instructions, as I have installed to a user directory, in order to accommodate having multiple versions of go.

When I go get . from my go project's src directory, I get the error message type already mentioned above ―

unrecognized import path (import path does not begin with hostname)

Can you please explain, why does go look for a hostname and how that should possibly be avoided in a typical project?

As an aside, the problem was originally encountered by me in setting up the following specific project and hash, which the accepted answer still refers to.

  • 写回答

1条回答 默认 最新

  • dpm91915 2017-11-08 18:53
    关注

    go get downloads dependencies and packages by assuming that the import path (in the import statements in source code) identifies a URL where the package can be downloaded, e.g. github.com/habeanf/yap. It works so long as developers use imports correctly; unfortunately, the developer of the yap project did not.

    Where they import yap/app, they should be importing github.com/habeanf/yap/app, etc. The only fix would be to clone the GitHub repo into $GOPATH/src/yap manually and then try to build it. You might want to open a GitHub issue on that project and request that they fix the import paths so it can be built like a normal Go project.

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

报告相同问题?

悬赏问题

  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题