go.mod具有后v0模块路径"git.example.com/owner/repo/v3",在修订...? [英] go.mod has post-v0 module path "git.example.com/owner/repo/v3" at revision ...?

查看:156
本文介绍了go.mod具有后v0模块路径"git.example.com/owner/repo/v3",在修订...?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的同事在更新go.mod后添加/v3后缀(

My coworker pushed a tag v3.0.1 before updating go.mod to have /v3 suffix (https://github.com/golang/go/wiki/Modules#releasing-modules-v2-or-higher). I have updated module path (go.mod) and all import paths (*.go) to fix it, tagged as 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.mod具有post-v0模块路径

因此,我删除了v3.0.0v3.0.1标记,将其指向最新的提交,然后再次按下,但问题仍然存在.

So, I deleted both v3.0.0 and v3.0.1 tags, pointed it to the latest commit, re-pushed but the problem still stand.

我注意到go.mod仍将旧版本称为间接依赖项:

I noticed that go.mod still refered to the old version as an indirect dependency:

require (
    git.example.com/owner.repo v0.1.2 // indirect

即使我将其更改为/v3 v3.0.2,它也会自动恢复为v0.1.12.

Even if I changed it to /v3 v3.0.2 it will be restored to v0.1.12 automatically.

为什么?

我错过了什么吗?

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

(d85c4f69ad17master中的最新提交)

我注意到go.sum中同时存在v0.1.2v3.0.2:

I noticed that there are both v0.1.2 and v3.0.2 in 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=

推荐答案

请注意我的go get命令:

go get -v git.example.com/owner/repo@v3.0.2

应该是:

go get -v git.example.com/owner/repo/v3@v3.0.2

这篇关于go.mod具有后v0模块路径"git.example.com/owner/repo/v3",在修订...?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆