带有不存在标签的伪版本

Where pseudo version with non-existent tag

从启用 go.mod 的模块中导入 GOPATH 样式依赖项时,我得到一个神秘的伪版本。

$ cd $(mktemp -d)
$ go mod init github.com/foo/test
go: creating new go.mod: module github.com/foo/test
$ go get github.com/bar/api@master
$ cat go.mod 
module github.com/foo/test

go 1.12

require (
    github.com/bar/api v3.9.1-0.20190923092516-169848dd8137+incompatible // indirect
)
$ 

github.com/bar/api 仓库只定义了一个 v3.9.0 标签。 master 分支在此之前进行了几次提交。

有人知道 v3.9.1 标签是从哪里提取的吗?该标签不存在。提交 ID 169848dd8137 确实指向 masterHEAD,但未标记。只是 go mod 只是聪明地说嘿,在 v3.9.0 标记之后提交意味着 v3.9.1 的某个版本?

这是一个'pseudo-version',在这里解释:

https://tip.golang.org/cmd/go/#hdr-Pseudo_versions

简而言之,由于您选择了@master,它会使用 master 分支上最新提交的时间戳和哈希创建此版本。版本号是从最新的标签+1修订生成的。

这是预期的行为。这是来自上述 link 的信息 -

vX.Y.(Z+1)-0.yyyymmddhhmmss-abcdefabcdef is used when the most recent versioned commit before the target commit is vX.Y.Z.