Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

升级到go 1.13无法get #93

Closed
BenedictKing opened this issue Sep 6, 2019 · 5 comments
Closed

升级到go 1.13无法get #93

BenedictKing opened this issue Sep 6, 2019 · 5 comments

Comments

@BenedictKing
Copy link

之前go 1.12可以正常用v1.0.5,现在go升级到1.13
执行:
go get -u github.com/gohouse/gorose@v2.0.5
出错:
go get github.com/gohouse/gorose@v2.0.5: github.com/gohouse/gorose@v2.0.5: invalid version: module contains a go.mod file, so major version must be compatible: should be v0 or v1, not v2

@starjiang
Copy link

确实,golang 升级到1.13 后报这个错了

@fizzday
Copy link
Member

fizzday commented Sep 9, 2019

@starjiang @ZhiweiWang 目前遇到一个奇怪的问题, 版本都是按照常规的tag标记的, 但是只能识别到1.x, 不能识别到2.x, 你们有没有遇到这个问题

@BenedictKing
Copy link
Author

大版本需要改mod为v2

Go 项目如何升级 v2?
假设你的项目已经支持 go module 了。

修改 go.mod 第一行,在module那行最后加上/v2。module github.com/mnhkahn/aaa/v2。
对于不兼容的改动(除了 v0 和 v1),都必须显示得修改 import 的路径。所以我们的引用需要改成 import "github.com/mnhkahn/aaa/v2/config"。在所有的地方都需要修改,包括自己的包内和调用方包。
底层包的更新有个小工具可以帮助快速实现mod。GO111MODULE=on go get github.com/marwan-at-work/mod/cmd/mod && mod upgrade。
代码提交之后需要打新 tag,v2.0.0。
调用方修改引用代码,需要加v2,和第二步提到的一样。
go get github.com/mnhkahn/aaa/v2。

@BenedictKing
Copy link
Author

BenedictKing commented Sep 10, 2019

@fizzday 试了一下用mod upgrade确实可行
go get -u github.com/ZhiweiWang/gorose/v2

@fizzday
Copy link
Member

fizzday commented Sep 10, 2019

@ZhiweiWang 确实可以, 我修正下, 多谢指教

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants