dsg56465 2019-07-22 10:14
浏览 224
已采纳

go.mod在修订版中具有v0后的模块路径“ git.example.com/owner/repo/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.

Now the problem is:

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

Found this: go build keeps complaining that: go.mod has post-v0 module path

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.

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

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

Why?

Did I miss something?


Tue Jul 23 05:54:56 +07 2019

rm go.*
go mod init git.example.com/dependent/project
go mod tidy

and go.mod is updated correctly now:

require (
-       git.example.com/owner/repo v0.1.2
+       git.example.com/owner/repo/v3 v3.0.2

but go get -v git.example.com/owner/repo@v3.0.2 still returned the error:

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 is the latest commit in master)

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=
  • 写回答

3条回答 默认 最新

  • duanhongyi2964 2019-07-23 08:07
    关注

    Please pay attention to my go get command:

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

    It should be:

    go get -v git.example.com/owner/repo/v3@v3.0.2
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?