vcs在Golang中的缓存目录是什么?

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

What is vcs in cache directory in Golang?

问题

我发现在缓存目录($GOPATH/pkg/mod/cache)中有一个vcs目录(如下图所示):

vcs在Golang中的缓存目录是什么?

我还发现我的公司私有模块存储在那里(每个模块都有自己的哈希名称目录、info和lock)。特别是,在哈希名称目录中有像带有git的项目一样的东西-您可以使用git log来显示每个提交)。

有人知道这个目录的目的以及它是如何创建的吗?提前感谢。

P/s:go mod download -x命令显示从这里创建了模块的zip版本,使用了git archive(可以在下载目录中找到-如上图所示)。

英文:

I found that in cache directory ($GOPATH/pkg/mod/cache) has vcs directory (image below):

vcs在Golang中的缓存目录是什么?

I also found that my company private modules are stored in there (each module has its hashed name directory, info and lock). Especially, in hashed name directory is something like project with git - you can use git log to show every commits).

Does anyone know what is the purpose of this directory and how is it created? Thank in advance.

P/s: go mod download -x command shows that zip version of module created from here with git archive (can be found on download directory - image above)

答案1

得分: 2

请参考Go Modules 参考 - 模块缓存

cache/vcs/

包含从源直接获取的模块的克隆版本控制存储库。目录名称是从存储库类型和 URL 派生的十六进制编码哈希值。存储库在磁盘上被优化为占用较小的空间。例如,克隆的 Git 存储库在可能的情况下是裸仓库和浅克隆的。

英文:

See Go Modules Reference - Module cache:

> cache/vcs/
>
> Contains cloned version control repositories for modules fetched directly from their sources. Directory names are hex-encoded hashes derived from the repository type and URL. Repositories are optimized for size on disk. For example, cloned Git repositories are bare and shallow when possible.

huangapple
  • 本文由 发表于 2023年5月3日 19:48:27
  • 转载请务必保留本文链接:https://go.coder-hub.com/76163454.html
匿名

发表评论

匿名网友

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

确定