在Go项目中是否应该使用git子模块?

huangapple go评论69阅读模式
英文:

Should I use git submodules in go project?

问题

有一个用Go语言编写的项目,并且使用git进行管理。我应该使用git子模块还是只使用导入指令来使用第三方项目?

例如:

// 只使用导入指令。
import "github.com/3rd-party/dep"

// 使用子模块。
$ cd myown
$ git add submodule https://github.com/3rd-party/dep dep
$ ...
import "github.com/myown/dep"

英文:

There's a project written in go language. And it's managed using git. Should I use git submodules or just import directives to use a 3rd-party project?

For example:

// Just use import directive.
import "github.com/3rd-party/dep"

// From a submodule.
$ cd myown
$ git add submodule https://github.com/3rd-party/dep dep
$ ...
import "github.com/myown/dep"

答案1

得分: 2

你应该使用 import "github.com/3rd-party/dep",然后在工作目录中运行 go get

英文:

You should use import "github.com/3rd-party/dep"
and then run go get in the working directory

答案2

得分: -3

只需导入指令。
Git子模块的声誉不佳。

英文:

Just import directive.
Git submodules has a bad rep.

huangapple
  • 本文由 发表于 2015年3月6日 17:16:56
  • 转载请务必保留本文链接:https://go.coder-hub.com/28895590.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定