doupi6737 2018-10-20 19:33
浏览 281
已采纳

Golang中的版本控制第三方软件包

I am using third party packages in golang and I want to add them to my git repository and when I type the command git add . it is giving me the following error

warning: adding embedded git repository: github.com/beorn7/perks
hint: You've added another git repository inside your current repository.
hint: Clones of the outer repository will not contain the contents of
hint: the embedded repository and will not know how to obtain it.
hint: If you meant to add a submodule, use:
hint: 
hint:   git submodule add <url> github.com/beorn7/perks
hint: 
hint: If you added this path by mistake, you can remove it from the
hint: index with:
hint: 
hint:   git rm --cached github.com/beorn7/perks
hint: 

How to make sure that I am version controlling packages correctly and Am I doing the right way of version controlling my third-party packages?

Here is my project structure

Project/
|
src/
  |
   github.com/
      |
      packages/

My GOPATH is also pointing to project directory

  • 写回答

1条回答 默认 最新

  • douzepao0281 2018-10-20 19:47
    关注

    From what I understand you don't use any package manager, instead you import packages to your $GOPATH. I would advise you to use package manager like dep which builds vendor directory containing all dependencies. When you run dep ensure it will go through your code and pull all the dependencies automatically.

    Edit: As @jubobs since go1.11 you can use go mod. Basic premise is the same as dep.

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

报告相同问题?

悬赏问题

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