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 Centos7 / PETGEM
  • ¥15 csmar数据进行spss描述性统计分析
  • ¥15 各位请问平行检验趋势图这样要怎么调整?说标准差差异太大了
  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题
  • ¥15 wpf界面一直接收PLC给过来的信号,导致UI界面操作起来会卡顿
  • ¥15 init i2c:2 freq:100000[MAIXPY]: find ov2640[MAIXPY]: find ov sensor是main文件哪里有问题吗
  • ¥15 运动想象脑电信号数据集.vhdr
  • ¥15 三因素重复测量数据R语句编写,不存在交互作用
  • ¥15 微信会员卡等级和折扣规则
  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗