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

Align semver libs #52795

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Align semver libs #52795

wants to merge 1 commit into from

Conversation

hugoShaka
Copy link
Contributor

@hugoShaka hugoShaka commented Mar 5, 2025

This PR aligns semantic version handling in automatic updates to coreos/go-semver.

This started from a comment from @espadolini during a review, I postponed the refactoring until the MVP got out. This PR now addresses the tech debt I left.

Why not x/mod/semver?

x/mod/semver uses strings to carry versions. We have to always check that the version is normalized. This ended up in some functions taking versions with the leading "v" and some not. This causes significant cognitive overload each time we deal with version and increases the risk of using the wrong one. In autoupdate we were sometimes removing and adding back the leading "v" 4 times.

Teleport uses a mix of coreos/go-semver and x/mod/semver. I did not change the other semver usages but thing we should use coreos/go-semver more as it offer stronger typing and a more developer-friendly API.

@hugoShaka hugoShaka force-pushed the hugo/align-semver-libs branch 3 times, most recently from ead34e4 to d4b9b87 Compare March 5, 2025 18:48
@hugoShaka hugoShaka marked this pull request as ready for review March 5, 2025 18:51
@github-actions github-actions bot requested review from bernardjkim and tigrato March 5, 2025 18:51
@hugoShaka hugoShaka added the no-changelog Indicates that a PR does not require a changelog entry label Mar 5, 2025
@hugoShaka hugoShaka force-pushed the hugo/align-semver-libs branch from d4b9b87 to e6f64be Compare March 6, 2025 14:57
Copy link
Contributor

@espadolini espadolini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How many uses of x/mod/semver are left? If it's not too many you could add it to depguard and add lint exceptions for the existing places where we still use it, to prevent it from spreading further.

@hugoShaka
Copy link
Contributor Author

How many uses of x/mod/semver are left? If it's not too many you could add it to depguard and add lint exceptions for the existing places where we still use it, to prevent it from spreading further.

About 10 or 15 files. I'll ask the file owners before if they are comfortable with this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discovery kubernetes-access no-changelog Indicates that a PR does not require a changelog entry size/sm
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants