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 算法使用了tf-idf,用手肘图确定k值确定不了,第四轮廓系数又太小才有0.006088746097507285,如何解决?(相关搜索:数据处理)
  • ¥15 彩灯控制电路,会的加我QQ1482956179
  • ¥200 相机拍直接转存到电脑上 立拍立穿无线局域网传
  • ¥15 (关键词-电路设计)
  • ¥15 如何解决MIPS计算是否溢出
  • ¥15 vue中我代理了iframe,iframe却走的是路由,没有显示该显示的网站,这个该如何处理
  • ¥15 操作系统相关算法中while();的含义
  • ¥15 CNVcaller安装后无法找到文件
  • ¥15 visual studio2022中文乱码无法解决