-
Notifications
You must be signed in to change notification settings - Fork 40.7k
cleanup: Migrate deprecated function ExtractCommentTags #131711
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
base: master
Are you sure you want to change the base?
cleanup: Migrate deprecated function ExtractCommentTags #131711
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: gavinkflam The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Welcome @gavinkflam! |
Hi @gavinkflam. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
259a811
to
2e1490d
Compare
2e1490d
to
ed73a19
Compare
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.
/ok-to-test
Pipeline is all green. PTAL |
/assign @yongruilin |
/triage accepted |
@yongruilin Just checking in - did you have a chance to take a look? |
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.
/hold
Please wait for #132110 merge and rebase on it.
// Then this function will return: | ||
// | ||
// map[string][]string{"foo":{"val1", "val2", "val3"}, "bar": {""}, "baz": {`"qux"`}} | ||
func ExtractCommentTagsWithoutArguments(marker string, tagNames []string, lines []string) (map[string][]string, 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.
Could you help me to understand why this is needed for the above generators?
If it is common enough, I suggest to put it inside gengo/v2, then import it to use.
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.
The existing generator tags are not function-style, so the behavior of function-style usages is undefined. I propose we simply ignore tags that include arguments, but I’m happy to adjust the implementation if we decide to handle them differently.
This helper function helps reduce boilerplate by filtering and collecting parsed tags. It’s probably too specific for gengo/v2, but I’d be glad to submit it there if you think it might be useful.
Example Usage | Proposed Effect |
---|---|
+k8s:deepcopy-gen:nonpointer-interfaces=true |
Accepted |
+k8s:deepcopy-gen:nonpointer-interfaces()=true |
Accepted |
+k8s:deepcopy-gen:nonpointer-interfaces(a=1)=true |
Ignored |
What are your thoughts?
cc @jpbetz
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.
Let's be strict and have the code generator fail with an error if an unexpected argument ((a=1)
case) is present.
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.
Sounds good. I can tweak that.
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.
Done and rebased. New behavior:
Example Usage | Proposed Effect |
---|---|
+k8s:deepcopy-gen:nonpointer-interfaces=true |
Accepted |
+k8s:deepcopy-gen:nonpointer-interfaces()=true |
Accepted |
+k8s:deepcopy-gen:nonpointer-interfaces(a=1)=true |
Error |
ed73a19
to
87bad77
Compare
Signed-off-by: Gavin Lam <[email protected]>
87bad77
to
f4ab6c2
Compare
@yongruilin #132110 is merged yesterday. I've rebased and the pipeline is green. Please take another look. |
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
ExtractCommentTags is deprecated, and we need to migrate the usages to ExtractFunctionStyleCommentTags.
This PR addresses some low-hanging fruits and introduces a utility function to facilitate further migration of the remaining usages.
Which issue(s) this PR fixes:
Part of #130358
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: