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.2go: finding git.example.com/owner/repo v3.0.2go: 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 has post-v0 module path因此,我删除了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自动恢复。为什么?我错过了什么?7 月 23 日星期二 05:54:56 +07 2019rm go.*go mod init git.example.com/dependent/projectgo 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.2go: 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.2go.sumgit.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=
3 回答
繁华开满天机
TA贡献1816条经验 获得超4个赞
请注意我的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
月关宝盒
TA贡献1772条经验 获得超5个赞
我可能遇到过类似的问题,我更新了一个模块以使用 /v2 导入路径,但获取模块总是返回有关无效 go.mod 的错误
解决办法是go get -u github.com/<me>/<pkg>/v2
HUX布斯
TA贡献1876条经验 获得超6个赞
我可能遇到过类似的问题,我更新了一个模块以使用 /v2 导入路径,但获取模块总是返回有关无效 go.mod 的错误
解决办法是go get -u github.com/<me>/<pkg>/v2
- 3 回答
- 0 关注
- 161 浏览
添加回答
举报
0/150
提交
取消