Align gomod major version with project major version #734
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is unfortunately needed because gomod has a very odd behavior when it comes to semver tags. It essentially expects that a major version bump in semver also requires a completely different Go import path.
While this may make sense in projects that are solely a self-contained Go package and where a major version bump indicates an API break of that Go package. It's a lot weirder when dealing with a much more complex project like Incus where our external facing Go API is just a small part of the whole thing and a major version bump of the project may not mean an API break for the users of the Go package.
This is made extra annoying by Go special casing the 0 and 1 major releases as not needing this kind of import name changes, causing the whole thing to break when you exceed that.
For us the consequence was that anyone using
@latest
was still getting Incus 0.7 rather than6.0.0
. With this change, it should now cause import errors for most people, requiring them to update togithub.com/lxc/incus/v6/client
to get things working again.This is annoying and really unneeded but that's how Gomod works...