-
Notifications
You must be signed in to change notification settings - Fork 150
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
add Core func #85
add Core func #85
Conversation
Perhaps we could call this function |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I suppose this doesn't need too wide attention/approval given that the change is additive and shouldn't break existing usage, but it would be useful to have an additional 👍🏻 from TF core.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes sense to me, and I think we'd probably use it to address hashicorp/terraform#28148 while still preserving the existing behaviour of ignoring prerelease versions when evaluating version constraint inequalities.
Adds a Core function to Version, which returns a new Version created from only the MAJOR.MINOR.PATCH segments of the original version, without prerelease or metadata strings. Consumers of go-version often want to treat prereleases of versions as equal to non-prerelease versions, e.g. 0.15.0-dev as equal to 0.15.0. The present functionality is intended as an easy way to opt in to this behaviour.
The semver spec actually calls this core in the grammar (https://semver.org/#backusnaur-form-grammar-for-valid-semver-versions), so I've renamed it. Would appreciate a go-ahead from both of you on this. |
Adds a Core function to Version, which returns a new Version created from only the MAJOR.MINOR.PATCH segments of the original version, without prerelease or metadata strings.
Consumers of go-version often want to treat prereleases of versions as equal to non-prerelease versions, e.g. 0.15.0-dev as equal to 0.15.0. The present functionality is intended as an easy way to opt in to this behaviour.
Example in a library used by the Terraform Language Server:
https://github.com/hashicorp/terraform-schema/blob/8c206fbd85ae346716b4efbd776c8b8097fc5b42/schema/core_schema.go#L47-L52