这两个用于MongoDB/golang mgo驱动程序的import语句哪个是正确的?

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

Which of these two import statements for the MongoDB/golang mgo driver is correct?

问题

这两个导入语句是用于同一个 mgo(MongoDB/golang)库的,它们之间有什么区别呢?

gopkg.in/mgo.v2
labix.org/v2/mgo

我知道你必须选择其中一个,但它们对我来说似乎都能正常工作。为什么会有两个版本,我应该使用哪一个?

英文:

Could someone shed some light on the difference between these two import statements for the same mgo (MongoDB/golang) library:

gopkg.in/mgo.v2
labix.org/v2/mgo

I know you have to pick one or the other, but they both seem to work the same for me. Why are there two and which one should I be using?

答案1

得分: 0

它们是同一个包,mgo没有强制规定规范的导入方式。

根据文档的说明,使用"gopkg.in/mgo.v2"。

英文:

They are the same package, and there is no canonical import enforced for mgo.

Use the "gopkg.in/mgo.v2", if only because that's what the documentation states.

huangapple
  • 本文由 发表于 2015年12月12日 05:47:31
  • 转载请务必保留本文链接:https://go.coder-hub.com/34233073.html
匿名

发表评论

匿名网友

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

确定