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 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?