2

sequence

This article mainly studies the Pseudo-versions of golang

Pseudo-versions

definition

Pseudo-versions, Chinese probably means pseudo version, that is, those without semantic version tag ( semantic version tags ) will use pseudo version

Format

Similar to v0.0.0-yyyymmddhhmmss-abcdefabcdef , the middle time is UTC time ( 东八区为utc+8 ), the last 12 bits are the first 12 bits of the git commit hash

forms

  • vX.0.0-yyyymmddhhmmss-abcdefabcdef

    If there is no major semantic version tag before, the first part of its Pseudo version is vX.0.0
  • vX.YZ-pre.0.yyyymmddhhmmss-abcdefabcdef

    Commits submitted after the vX.YZ-pre( v3.9.0-pre ) version, the first part of the Pseudo version is vX.YZ-pre.0( v3.9.0-pre.0 )
  • vX.Y.(Z+1)-0.yyyymmddhhmmss-abcdefabcdef

    The commit submitted after the vX.YZ( v3.9.0 ) version, the first part of its Pseudo version is vX.Y.(Z+1)-0( v3.9.1-0 )

+incompatible

For some dependencies without go.mod, go.sum will appear +incompatible , such as

 github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=

question

  • The version based on the branch commit will cause go mod invalid version after the change commit is deleted

    For example, when merging from a feature branch to the trunk, git merge --squash and deleting the feature branch at the same time will cause the commit that depends on the previous feature branch to be lost, and finally the project that depends on this commit cannot be built.
  • The tag-based version will also appear go mod invalid version when the tag is deleted

    Other languages, such as java's maven, are managed by the warehouse. Unless there are special circumstances, the version will generally not be deleted from the warehouse, and generally there will be no misoperation. Pay special attention to this point of go, and be careful when deleting tags.

summary

Go's Pseudo-versions is somewhat similar to the concept of maven's snapshot, which is based on timestamps, but go's warehouse is based on git warehouse, so it brings the hash information of commit. But pay special attention to the issue of go mod invalid version.

doc


codecraft
11.9k 声望2k 粉丝

当一个代码的工匠回首往事时,不因虚度年华而悔恨,也不因碌碌无为而羞愧,这样,当他老的时候,可以很自豪告诉世人,我曾经将代码注入生命去打造互联网的浪潮之巅,那是个很疯狂的时代,我在一波波的浪潮上留下...