What does the Go Mod require mean

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

What does the Go Mod require mean

问题

关于https://stackoverflow.com/questions/53682247/how-to-point-go-module-dependency-in-go-mod-to-a-latest-commit-in-a-repo的问题

我在go.mod文件中有以下的require:

require (
	github.com/onsi/ginkgo v1.16.5
	github.com/onsi/gomega v1.18.1
	k8s.io/api v0.24.2
	k8s.io/apimachinery v0.24.2
	k8s.io/client-go v0.24.2
	sigs.k8s.io/controller-runtime v0.12.2
	sigs.k8s.io/kubebuilder-declarative-pattern v0.11.20220513-0.20220602225619-fe5be9431eae // 为了status而添加(运行go mod tidy)

)

我无法理解最后一个。该仓库是https://github.com/kubernetes-sigs/kubebuilder-declarative-pattern
它没有名为v0.11.20220513的标签(https://github.com/kubernetes-sigs/kubebuilder-declarative-pattern/tags)
它有一个提交标签fe5be9431eae

有人知道如何访问v0.11.20220513-0.20220602225619-fe5be9431eae所指向的提交,并且每个部分的含义是什么吗?

英文:

Related to https://stackoverflow.com/questions/53682247/how-to-point-go-module-dependency-in-go-mod-to-a-latest-commit-in-a-repo

I have the following require in go.mod file

require (
	github.com/onsi/ginkgo v1.16.5
	github.com/onsi/gomega v1.18.1
	k8s.io/api v0.24.2
	k8s.io/apimachinery v0.24.2
	k8s.io/client-go v0.24.2
	sigs.k8s.io/controller-runtime v0.12.2
	sigs.k8s.io/kubebuilder-declarative-pattern v0.11.20220513-0.20220602225619-fe5be9431eae // Added for status (run go mod tidy)

)

The last one I am not able to understand. The repo is https://github.com/kubernetes-sigs/kubebuilder-declarative-pattern
It does NOT have a tag named v0.11.20220513 (https://github.com/kubernetes-sigs/kubebuilder-declarative-pattern/tags)
It has a commit tag fe5be9431eae

Anyone has an idea how to go to the commit referred to by v0.11.20220513-0.20220602225619-fe5be9431eae and what does each part mean?

答案1

得分: 2

https://go.dev/ref/mod#pseudo-versions:

伪版本是一种特殊格式的预发布版本,它编码了有关版本控制存储库中特定修订的信息。例如,v0.0.0-20191109021931-daa7c04131f5 是一个伪版本。

因此,一旦你阅读了上面链接的完整的伪版本部分,你会发现版本v0.11.20220513-0.20220602225619-fe5be9431eae由以下三个部分组成:

  1. v0.11.20220513:基础版本v0.11.20220512+1。

    > 当基础版本是类似于vX.Y.Z的发布版本时,使用vX.Y.(Z+1)-0.yyyymmddhhmmss-abcdefabcdef。例如,如果基础版本是v1.2.3,伪版本可能是v1.2.4-0.20191109021931-daa7c04131f5。

  2. 0.20220602225619:是时间戳0.yyyymmddhhmmss
    > 时间戳(yyyymmddhhmmss),表示修订创建的UTC时间。在Git中,这是提交时间,而不是作者时间。

  3. fe5be9431eae:是提交哈希
    > 修订标识符(abcdefabcdef),是提交哈希的12个字符前缀,或者在Subversion中是零填充的修订号。

英文:

https://go.dev/ref/mod#pseudo-versions:

> A pseudo-version is a specially formatted pre-release version that
> encodes information about a specific revision in a version control
> repository. For example, v0.0.0-20191109021931-daa7c04131f5 is a
> pseudo-version.

So, once you read the full pseudo-versions section that's linked above, you'll find out that the version
v0.11.20220513-0.20220602225619-fe5be9431eae is composed of the following three parts:

  1. v0.11.20220513: the base version v0.11.20220512+1.

    > vX.Y.(Z+1)-0.yyyymmddhhmmss-abcdefabcdef is used when the base version
    > is a release version like vX.Y.Z. For example, if the base version is
    > v1.2.3, a pseudo-version might be
    > v1.2.4-0.20191109021931-daa7c04131f5.

  2. 0.20220602225619: is the timestamp 0.yyyymmddhhmmss.
    > A timestamp (yyyymmddhhmmss), which is the UTC time the revision was created. In Git, this is the commit time, not the author time.

  3. fe5be9431eae: is the commit hash.
    > A revision identifier (abcdefabcdef), which is a 12-character prefix of the commit hash, or in Subversion, a zero-padded revision number.

答案2

得分: 1

根据pseudo-version的解释,这里的第三部分是提交哈希的前12个字符。因此,你可以通过浏览<repo-path>/commit/<commit-prefix>直接访问仓库上的提交。

在你的情况下,链接是https://github.com/kubernetes-sigs/kubebuilder-declarative-pattern/commit/fe5be9431eae

英文:

As pseudo-version explains, the third part of this is a 12-character prefix of the commit hash. so you can go to the commit on the repo directly by browsing &lt;repo-path&gt;/commit/&lt;commit-prefix&gt;.

In your case, it is https://github.com/kubernetes-sigs/kubebuilder-declarative-pattern/commit/fe5be9431eae

huangapple
  • 本文由 发表于 2022年8月24日 15:57:09
  • 转载请务必保留本文链接:https://go.coder-hub.com/73469452.html
匿名

发表评论

匿名网友

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

确定