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 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥85 maple软件,solve求反函数,出现rootof怎么办?
  • ¥15 求chat4.0解答一道线性规划题,用lingo编程运行,第一问要求写出数学模型和lingo语言编程模型,第二问第三问解答就行,我的ddl要到了谁来求了
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥15 maple软件,用solve求反函数出现rootof,怎么办?
  • ¥65 汇编语言除法溢出问题
  • ¥15 Visual Studio问题
  • ¥20 求一个html代码,有偿
  • ¥100 关于使用MATLAB中copularnd函数的问题