-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Closed as not planned
Closed as not planned
Copy link
Labels
kind/bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.Denotes an issue or PR that has aged beyond stale and will be auto-closed.needs-triageIndicates an issue or PR lacks a `triage/foo` label and requires one.Indicates an issue or PR lacks a `triage/foo` label and requires one.
Description
What happened?
internal libary cmd/gorepomod/internal/semver/semver.go
has a function Parse(raw string)
which translate a raw string into Semver object. However, if we supply string with CRLF (\r\n
), it will return a default behavior zero
which translates to v0.0.0
. This makes semver.Parse()
function cannot translate kustomize libarary current versioning e.g. kyaml right now is v0.15.1
due to Git commands returns results with CRLF.
Note: the function will not throw an error, but it will throw a default behavior
What did you expect to happen?
The correct behavior
semver.Parse("v0.15.1")
will result &Semver{major: 0, minor: 15, patch: 1}
How can we reproduce it (as minimally and precisely as possible)?
Usage:
// Call a git function
currentBranchName, err := gr.run(noHarmDone, "rev-parse", "--abbrev-ref", "release-kyaml/v0.16.3")
// Split branch name string
currentVersionString := strings.Split(currentBranchName, "/")
// Supply raw string to parse function
version, _ := semver.Parse(currentVersionString[1])
Expected output
version, _ := semver.Parse("v0.16.3")
// will return v0.16.3 Semver object
&Semver{major: 0, minor: 16, patch: 3}
Actual output
// return v0.0.0 Semver object
&Semver{major: 0, minor: 0, patch: 0}
Kustomize version
v5.3.0
Operating system
Linux
Metadata
Metadata
Assignees
Labels
kind/bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.Denotes an issue or PR that has aged beyond stale and will be auto-closed.needs-triageIndicates an issue or PR lacks a `triage/foo` label and requires one.Indicates an issue or PR lacks a `triage/foo` label and requires one.