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

Golang modules does not like short version tags #5019

Closed
physcat opened this issue Jul 25, 2019 · 8 comments
Closed

Golang modules does not like short version tags #5019

physcat opened this issue Jul 25, 2019 · 8 comments
Labels
good first issue Good issue for new contributors

Comments

@physcat
Copy link

physcat commented Jul 25, 2019

Please add the patch version number to the Major releases tags in git. i.e.
for v3.0 add v3.0.0

Golang modules uses Semantic Versioning (https://semver.org/) to find versions.

When a developer does build or a get, they will get v2.1.1 as go does not recognise v3.0

$ go get -u vitess.io/vitess
$ grep vitess go.mod
	vitess.io/vitess v2.1.1+incompatible

This will result in errors such as:

./main.go:222:30: not enough arguments in call to vitessdriver.Open
	have (string, string)
	want (string, string, string, time.Duration)

The full list of tags that go modules recognises are:

$ go list -m -versions vitess.io/vitess
vitess.io/vitess v2.0.0-alpha1+incompatible v2.0.0-alpha2+incompatible v2.0.0-alpha3+incompatible v2.0.0-alpha4+incompatible v2.0.0-alpha5+incompatible v2.0.0-beta.1+incompatible v2.0.0-beta.2+incompatible v2.0.0-rc.1+incompatible v2.0.0-rc.2+incompatible v2.0.0+incompatible v2.1.0-alpha.1+incompatible v2.1.0-alpha.2+incompatible v2.1.0-rc.1+incompatible v2.1.0+incompatible v2.1.1+incompatible v2.2.0-rc.1+incompatible v3.0.0-rc.1+incompatible v3.0.0-rc.2+incompatible v3.0.0-rc.3+incompatible

Go will not install pre-release version by default, but since v3.0 and v3.0.0-rc3 are the same, the developer can do either:
$ go get vitess.io/vitess@v3.0
or
$ go get -u vitess.io/vitess@4f192d1
both will work, but resulting in the apparent dependency on a pre-release package:

$ grep vitess go.mod
	vitess.io/vitess v3.0.0-rc.3+incompatible
@morgo morgo added the good first issue Good issue for new contributors label Oct 22, 2019
@morgo
Copy link
Contributor

morgo commented Nov 13, 2019

The Vitess 4.0 release was tagged as v4.0.0, which should address this. I am going to close this issue for now, but please let me know if it doesn't fix it.

@morgo morgo closed this as completed Nov 13, 2019
@kirs
Copy link
Contributor

kirs commented Dec 5, 2019

I think this is still an issue.

go list -m -versions vitess.io/vitess
vitess.io/vitess v2.0.0-alpha1+incompatible v2.0.0-alpha2+incompatible v2.0.0-alpha3+incompatible v2.0.0-alpha4+incompatible v2.0.0-alpha5+incompatible v2.0.0-beta.1+incompatible v2.0.0-beta.2+incompatible v2.0.0-rc.1+incompatible v2.0.0-rc.2+incompatible v2.0.0+incompatible v2.1.0-alpha.1+incompatible v2.1.0-alpha.2+incompatible v2.1.0-rc.1+incompatible v2.1.0+incompatible v2.1.1+incompatible v2.2.0-rc.1+incompatible v3.0.0-rc.1+incompatible v3.0.0-rc.2+incompatible v3.0.0-rc.3+incompatible

There's no 4.0.0 or 4.0.0 in that list.

@physcat
Copy link
Author

physcat commented Dec 5, 2019

Yes, It looks like the modules are a bit stricter with major versions than I understood.

With the major version the import path needs updating for all the clients.

e.g.

- import "vitess.io/vitess/go/vt/vitessdriver"
+ import "vitess.io/vitess/v4/go/vt/vitessdriver"

I think this needs an update of go.mod

- module vitess.io/vitess
+ module vitess.io/vitess/v4

go 1.12

require (

But I've not been able to test this yet.

This will explain the current errors I see:

$ go list -m -versions vitess.io/vitess/v4
go list -m: module vitess.io/vitess/v4: reading https://proxy.golang.org/vitess.io/vitess/v4/@v/list: 410 Gone
$ export GOPROXY=
$ go list -m -versions vitess.io/vitess/v4
go: finding vitess.io/vitess/v4 v4.0.1
go list -m: vitess.io/vitess/v4@v4.0.1: invalid version: go.mod has non-.../v4 module path "vitess.io/vitess" (and .../v4/go.mod does not exist) at revision v4.0.1

@scbizu
Copy link

scbizu commented Apr 9, 2020

Can someone please reopen this issue ? IMO this issue is not fixed whether you taged v4.0 or v4.0.0 , as @physcat said , module name github.com/vitessio/vitess should be modified to the github.com/vitessio/vitess/v4 in order to remove the incompatible , or create the v4 directory to provide */v4 module as gax-go did. Maybe #5758 is the same issue ? 🤔

Refers to https://blog.golang.org/v2-go-modules

@sougou
Copy link
Contributor

sougou commented Apr 12, 2020

Reopening as requested.

@gordonyoon
Copy link

Ran into this issue. For anyone else who's looking, note that you can get packages by commit hash:

go get -u vitess.io/vitess@7e09d0c (for v8.0.0)

@sougou
Copy link
Contributor

sougou commented Dec 8, 2020

The golang modules approach will not work for the vitess versioning scheme. The work around I tried works fine, which is to stay under v1.0. I tagged the v7 release as https://github.com/vitessio/vitess/releases/tag/v0.7.0 and that worked. So, we should do the same for v8 and tag it as v0.8.0. Tagging @askdba.

@aquarapid
Copy link
Contributor

Since we have the workaround in place, and we're consistently generating the v0.xx.x == Vitess vxx.x tags now when we do releases, I'm going to close this.

$ go list -m -versions vitess.io/vitess | head -c92
vitess.io/vitess v0.7.0 v0.8.0 v0.9.0 v0.9.1 v0.9.2 v0.10.0 v0.10.1 v0.10.2 v0.11.0 v0.11.1

systay pushed a commit that referenced this issue Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good issue for new contributors
Projects
None yet
Development

No branches or pull requests

7 participants