英文:
What is vcs in cache directory in Golang?
问题
我发现在缓存目录($GOPATH/pkg/mod/cache)中有一个vcs目录(如下图所示):
我还发现我的公司私有模块存储在那里(每个模块都有自己的哈希名称目录、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):
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
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论