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

[Sorting] Captial Release Candidate is sorted before alpha releases #231

Open
Sijoma opened this issue Apr 2, 2024 · 1 comment
Open
Labels

Comments

@Sijoma
Copy link

Sijoma commented Apr 2, 2024

I'm not sure if its intended or not. Versions with a capital release candidate [-RC] are sorted before the -alpha.. releases. Lower case [-rc] then comes at the end.

A quick example when having the following versions:

Versions: 1.2.3, 8.5.0-rc2, 1.0, 8.5.0-alpha2, 8.5.0-RC2, 1.3, 2, 0.4.2
Sorted Output: 0.4.2, 1.0.0, 1.2.3, 1.3.0, 2.0.0, 8.5.0-RC2, 8.5.0-alpha2, 8.5.0-rc2

Expected Output: 0.4.2, 1.0.0, 1.2.3, 1.3.0, 2.0.0, 8.5.0-alpha2, 8.5.0-rc2, 8.5.0-RC2

Go Playground: https://go.dev/play/p/-X6MZ0OFYJT

@mattfarina
Copy link
Member

I can explain a little about what's going on. For SemVer there is a spec at https://semver.org. In the spec it specifically states:

Identifiers with letters or hyphens are compared lexically in ASCII sort order.

So, what is ASCII sort order? You can visualize it at sites like https://www.ascii-code.com. Ordering has all uppercase letters coming before lowercase letters. This is why you get the output you see. It's following the spec.

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

No branches or pull requests

2 participants