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 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
  • ¥30 求一段fortran代码用IVF编译运行的结果
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥30 python代码,帮调试,帮帮忙吧