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

Leading zeros are explicitly forbidden in Semantic Versioning #86

Open
dimalinux opened this issue Apr 20, 2021 · 2 comments
Open

Leading zeros are explicitly forbidden in Semantic Versioning #86

dimalinux opened this issue Apr 20, 2021 · 2 comments

Comments

@dimalinux
Copy link

This call version.NewSemver("1.010.2") should return an error due to the leading zero on the minor version, but it does not. When you add a leading zero, it is not clear if the number is in octal or base 10.

The wording of the specification (https://semver.org/) is:

A normal version number MUST take the form X.Y.Z where X, Y, and Z are non-negative integers, and MUST NOT contain leading zeroes. X is the major version, Y is the minor version, and Z is the patch version. Each element MUST increase numerically. For instance: 1.9.0 -> 1.10.0 -> 1.11.0.

@kevinashaw
Copy link

The possibility of someone using Octal in a version number is laughably low. Leading zeros are commonly used to improving file sorting in file systems.

@dimalinux
Copy link
Author

dimalinux commented May 25, 2023

The possibility of someone using Octal in a version number is laughably low.

I wasn't suggesting that anyone would. The chance that a numeric parser will see the leading zero and parse the number incorrectly as octal is extremely high. There is a reason the standard forbids leading zeros.

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

2 participants