-
Notifications
You must be signed in to change notification settings - Fork 810
Add Compare to oneof Interfaces if needed #224
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
Why in the world has this travis build been waiting for 12 hours to start? |
I don't know why. I just made quite a disrupting change. Maybe you want to merge this into your branch. |
@awalterschulze Will do |
Now then, all the |
I'm not sure I understand exactly what the compare plugin return values mean. I think |
https://www.gnu.org/software/libc/manual/html_node/Comparison-Functions.html The idea is that -1 is less than and +1 is greater than. |
There might be a wrong assumption. |
I see, thanks for the explanation, I wasn't aware of this general rule of GNU comparison functions. I'll take a look through the |
Please tell me if you need help here. |
Yeah, I've put this to the side for now, so I would appreciate any pointers you have. |
To be explicit: Yes I need help. |
Don't worry I got that. |
Cheers, no rush, just thought I wasn't explicit enough last time 😄 |
No problem :) |
The problem happens here
When oneof types dont match each of them will return 1, instead of checking whether the type has a smaller or bigger field number (or something else deterministic). |
Are you still interested in trying to fix this? It will require a bit of work in plugin/compare/compare.go |
I would like to but unfortunately I don't think I'll have time anytime soon - please go ahead and make the changes yourself if you get the time. |
I am still thinking about how to do this. If the types are the same you can simply compare the values, but in the case where the types are different, hmmm. |
Any decision on how best to solve this? |
How about a design something like this |
But using unsafe is not really an option. |
Ok we have to generated a type switch for each possible one of type for |
I wont have any time, feel free to commandeer this pull request if you can find the time. Thanks! |
I think this should fix #221.
Will need to see what errors Travis throws at me before this is ready.