-
Notifications
You must be signed in to change notification settings - Fork 876
chore: remove duplicates using the symmetric difference function #14469
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
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
d3aa5c4
to
ccbe85e
Compare
5af8f78
to
1cc418c
Compare
ccbe85e
to
bbcfc01
Compare
1cc418c
to
0a49b38
Compare
bbcfc01
to
ba492b2
Compare
369b2dc
to
2d5e40d
Compare
2d5e40d
to
028476d
Compare
028476d
to
6889229
Compare
cpy := make([]T, 0, len(a)) | ||
|
||
for _, v := range a { | ||
if ContainsCompare(cpy, v, equal) { |
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.
Why the repeated iteration? Can you not just keep a map[T]struct{}
around? Or are you trying to avoid the comparable
constraint?
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.
I am trying to avoid the comparable
constraint because the RBAC uses RoleIdentifier
structs which are not comparable 😢.
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.
Gotcha. We probably want to be careful that we don't use this for too large a slice then.
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.
Yea, atm the slices are in the order of 5-10 elements
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.
Approving to unblock.
Just limiting the diff of the giant organization sync PR.
The
SymmetricDifferenceFunc
used to include duplicates, which was incorrect.