hashicorp / hashicorp/go-version

Leading zeros are explicitly forbidden in Semantic Versioning

Open
#86 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
1.8k
Forks
165
Avg merge
23h 42m
Merged PRs (30d)
2

Description

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.