duanemei2194 2014-05-22 12:09
浏览 56
已采纳

使用私有git存储库时go工作区的结构

Ive been trying to work out what the standard folder layout/structure for go code/workspaces when you are not using github.

I can see how go get works when fetching github projects, but assumedly my own git projects would not have the {github.com}/{username}/{projectname} structure that is referenced by go get and how is structed on disk after you do go get

What layout and git get url should you have when using your own git private repositories?

  • 写回答

3条回答 默认 最新

  • dsovc00684 2014-05-22 22:35
    关注

    The package in itself carries no reference to where it is stored. You only have:

    package mypackage
    

    So, you can have your local version in your own structure, as Volker pointed out in his comment. This is the import path you use in your own projects:

    import "my/custom/path/mypackage"
    

    Then you can open source it and put mypackage onto GitHub. This will allow everyone else to get it with the go get command, but they will be using the github.com import:

    import "github.com/myuser/mypackage"
    

    This works perfectly fine unless you want to open-source packages which imports my/custom/path/mypackage. In such a case, you should consider restructuring your paths so that you use the same github import paths as the users of your package does.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器