Home > Net >  What does the Go Mod require mean
What does the Go Mod require mean

Time:08-24

Related to 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?

CodePudding user response:

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.

CodePudding user response:

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 <repo-path>/commit/<commit-prefix>.

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

  • Related