Googet should interpret the version string "1" as "1.0.0" instead of "0.0.1"
- Dominant language
- Go
- Stars
- 101
- Forks
- 51
- Avg merge
- 17h 1m
- Merged PRs (30d)
- 4
Description
[ParseVersion](https://github.com/google/googet/blob/6427b587db68578596f9133c7f5f975fcdd6a6d0/goolib/goospec.go#L189) and [fixVer](https://github.com/google/googet/blob/6427b587db68578596f9133c7f5f975fcdd6a6d0/goolib/goospec.go#L153) in goospec.go have the unexpected behavior of taking version strings with less than 3 components and converting them into 3-component versions by prepending leading 0s rather than appending 0s. This means that "1" becomes "0.0.1" and "1.2" becomes "0.1.2" which results in comparisons like
* "1" < "1.0" < "1.0.0"
* "2" < "1.1"
* "3" < "1.0.0"
* "1.5" < "1.2.0"
This is contrary to the behavior of [semver.ParseTolerant](https://pkg.go.dev/github.com/blang/semver#ParseTolerant) and common interpretations of version string comparisons.
Contributor guide
Assessment
This issue has not been assessed yet.