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
Prepare for chaining autogenerated conversion methods #7431
Conversation
@lavalamp @smarterclayton [update] |
In this change, please add instructions on generation to |
16d45a6
to
0078456
Compare
I've started writing this doc and uploaded few lines of it. However, I might not be able to finish it today. So it would be great if you could take a look at the code, before I'm done with the document. |
9f66589
to
6135d99
Compare
Separate the conversion changes into their own commit so it's easier to review. We probably want to formalize that in the policy around handling these (always put generations in a separate commit). |
6135d99
to
8cf7a69
Compare
Done |
8cf7a69
to
9a6f3df
Compare
Instead of
do
|
I'm going to improve how the cmd/kube-conversion/conversion.go is used in this PR too (tomorrow), but this won't change the code that is generated. So it would be great if you could look into that. Thanks! |
Instead of |
What's the golang limit on function names? |
@@ -0,0 +1,22 @@ | |||
API Changes |
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.
we already have a docs/devel/api_changes.md - merge?
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.
Thanks @thockin - sounds good to me. I will merge those two files (most probably tomorrow).
@@ -27,6 +27,7 @@ import ( | |||
type Generator interface { | |||
GenerateConversionsForType(version string, reflection reflect.Type) error | |||
WriteConversionFunctions(w io.Writer) error | |||
WriteConversionFunctionsForRegister(w io.Writer) error |
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.
What does "ForRegister" mean?
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 wasn't the best name. Fixed.
b06a158
to
b890642
Compare
I think that names without underscores ale closer to the styleguide (I didn't see any names with underscores anywhere). Why do you want to change this? All the other comments are applied - PTAL |
I'd be willing to make an exception in our style guide to improve the readability and scanability of the list. Also, it preserves the original casing of the names which is probably better.
|
b890642
to
f19ada7
Compare
I don't fully agree with that, but I see your point. Changed. PTAL |
BTW - I have almost ready the next PR, that is calling those conversion functions one from another without using reflections. That PR gives us another ~75% improvements (which is more than 10x from the original results), but since that new PR depends on this one, I will wait with submitting that one before this one is merged. |
One more nag - please alpha sort the conversion function references in
So you can quickly binary search visually to find them. Will make it easier to identify missed conversion bugs and diffs. Best order is a forced order. |
f19ada7
to
fc6fb09
Compare
Done - PTAL |
This is LGTM barring any final review from @lavalamp |
Thanks @smarterclayton ! |
My feedback is that it's not obvious which sections of the file are autogenerated and which aren't (add comments before the functions?) and that maybe you could generate it for v1, too, to keep that in sync? |
But I don't think that needs to block the PR. |
I definitely agree with it - tomorrow I will be working on the test whether the generated code wasn't manually edited and I will add it as part of it.
Can I do it in a separate PR?
If you're fine with merging as is, that would be great. I will address your two comments in a separate PR tomorrow. |
Prepare for chaining autogenerated conversion methods
Part of #6800
This PR is prerequisite for chaining autogenerated conversion methods. The next steps are:
@lavalamp @smarterclayton @fgrzadkowski