go工程为什么包的路径和它在code路径不一致?
比如这个图里,这个文件明明是 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 spanly 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.
以上是 go工程为什么包的路径和它在code路径不一致? 的全部内容, 来源链接: utcz.com/a/26078.html