v3.0.1
我的同事在更新之前推送了一个标签go.mod
以具有/v3
后缀(https://github.com/golang/go/wiki/Modules#releasing-modules-v2-or-higher)。我已经更新了模块路径 ( go.mod
) 和所有导入路径 ( *.go
) 来修复它,标记为v3.0.2
.
现在的问题是:
go get -v git.example.com/owner/repo@v3.0.2
go: finding git.example.com/owner/repo v3.0.2
go: git.example.com/owner/repo@v0.0.0-20190722053407-d85c4f69ad17: go.mod has post-v0 module path "git.example.com/owner/repo/v3" at revision
d85c4f69ad17
发现这个:go build 一直在抱怨:go.mod 有 post-v0 模块路径
所以,我删除了两个标签v3.0.0
,v3.0.1
将它指向最新的提交,重新推送,但问题仍然存在。
我注意到go.mod
仍然将旧版本称为间接依赖:
require (
git.example.com/owner.repo v0.1.2 // indirect
即使我将其更改为/v3 v3.0.2
它也会v0.1.12
自动恢复。
为什么?
我错过了什么?
2019 年 7 月 23 日星期二 05:54:56 +07
rm go.*
go mod init git.example.com/dependent/project
go mod tidy
并且go.mod
现在正确更新:
require (
- git.example.com/owner/repo v0.1.2
+ git.example.com/owner/repo/v3 v3.0.2
但go get -v git.example.com/owner/repo@v3.0.2
仍然返回错误:
go: finding git.example.com/owner/repo v3.0.2
go: git.example.com/owner/repo@v0.0.0-20190722053407-d85c4f69ad17: go.mod has post-v0 module path "git.example.com/owner/repo/v3" at revision
d85c4f69ad17
(d85c4f69ad17
是最新的提交master
)
我注意到两者都有v0.1.2
和:v3.0.2
go.sum
git.example.com/owner/repo v0.1.2 h1:mCGJEmyrFDTCGkRfUIORpqdrNkSONQ6K+AcTNgxqveY=
git.example.com/owner/repo v0.1.2/go.mod h1:FfUKnyPrARCtAXQZ3BQVJI7h2eJ0UpQBMLg4bNs4Kdc=
git.example.com/owner/repo/v3 v3.0.2 h1:mJtDKLeiP8vMRSZo08i/k/KDbIoZTlKW2aWu7DUBvMM=
git.example.com/owner/repo/v3 v3.0.2/go.mod h1:64LE0ts0Lk9InIQyhPYGmnxs6LZIl6H4Iorl1EXfqxo=