问答

golang 的工程,为什么包的路径和它在 code 路径下的路径不一致

作者:admin 2021-07-14 我要评论

比如这个图里,这个文件明明是 go-oauth2/oauth2,在github的地址也是的,但是它的引用路径却是 gopkg.in/oauth2.v4 ### 其实,你打开 https://gopkg.in 这个网站...

在说正事之前,我要推荐一个福利:你还在原价购买阿里云、腾讯云、华为云服务器吗?那太亏啦!来这里,新购、升级、续费都打折,能够为您省60%的钱呢!2核4G企业级云服务器低至69元/年,点击进去看看吧>>>)

image.png
比如这个图里,这个文件明明是 go-oauth2/oauth2,在github的地址也是的,但是它的引用路径却是 gopkg.in/oauth2.v4

###

其实,你打开 https://gopkg.in 这个网站就知道了

The gopkg.in service provides versioned URLs that offer the proper metadata for redirecting the go tool onto well defined GitHub repositories. Developers that choose to use this service are strongly encouraged to not make any backwards incompatible changes without also changing the version in the package URL. This convention improves the chances that dependent code will continue to work while depended upon packages evolve.

The advantage of using gopkg.in is that the URL is cleaner, shorter, redirects to the package documentation at godoc.org when opened with a browser, handles git branches and tags for versioning, and most importantly encourages the adoption of stable versioned package APIs.

Note that gopkg.in does not hold the package code. Instead, the go tool is redirected and obtains the code straight from the respective GitHub repository.

版权声明:本文转载自网络,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。本站转载出于传播更多优秀技术知识之目的,如有侵权请联系QQ/微信:153890879删除

相关文章
  • golang 的工程,为什么包的路径和它在

    golang 的工程,为什么包的路径和它在

  • android 原生跳转vue

    android 原生跳转vue

  • background 的 position 和 size 未正

    background 的 position 和 size 未正

  • 对于一个缺乏相关经验的企业,如果希望

    对于一个缺乏相关经验的企业,如果希望

腾讯云代理商
海外云服务器