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

Add sort.Sort support to operatorsv1.Components #271

Closed

Conversation

awgreene
Copy link
Member

This commit updates the operatorsv1.Components structure to implement the interface required by the sort.Sort function provided in golang.

Signed-off-by: Alexander Greene [email protected]

@openshift-ci
Copy link

openshift-ci bot commented Oct 27, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: awgreene

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 27, 2022
@awgreene
Copy link
Member Author

Part of the work required to fix operator-framework/operator-lifecycle-manager#2874

This commit updates the operatorsv1.Components structure to implement
the interface required by the sort.Sort function provided in golang.

Signed-off-by: Alexander Greene <[email protected]>
@awgreene
Copy link
Member Author

/hold

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 27, 2022
// Less returns true if argument i should appear in an ordered list
// of references before argument j.
// Used to implement the sort.Sort interface.
func (c Components) Less(i, j int) bool {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to define the functions to satisfy sort.Sort in the API? Or can we just call sort.Slice at the sort call site with this less function?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, moved it in that direction!

@awgreene awgreene closed this Oct 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants