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

Support parsing directives in comment of methods, structs, struct members and package doc #257

Closed
wants to merge 1 commit into from
Closed

Conversation

longit644
Copy link
Contributor

This PR add support for parsing directives in comment of methods, structs, and struct members

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Dec 22, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: longit644
Once this PR has been reviewed and has the lgtm label, please assign sttts for approval. For more information see the Kubernetes Code Review Process.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Dec 22, 2023
@k8s-ci-robot
Copy link
Contributor

Hi @longit644. 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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Dec 22, 2023
@longit644 longit644 changed the title Support parsing directives in comment of methods, structs, and struct members Support parsing directives in comment of methods, structs, struct members and package doc Dec 22, 2023
@thockin
Copy link
Member

thockin commented Jan 28, 2024

Hi. I am currently overhauling gnengo (#259) and looking at PRs.

This PR doesn't explain WHY you need this, and keeping a fork of ast is not something we really want to do.

IF we were to consider this it would be on v2, and I don't think we want to at first glance.

@thockin thockin closed this Jan 28, 2024
@longit644
Copy link
Contributor Author

Hi @thockin,

Thank you for your response.

This PR adds parsing directive to support another new marker creation method for generator. It uses directive syntax //k8s:..., similar to how recent Go versions have transitioned from // +build to //go:build

If you believe this adds value to gengo, I would be happy to create another PR on v2.

@thockin
Copy link
Member

thockin commented Jan 29, 2024

Do those not get retained as comments?

I don't think we want to keep a fork of AST for this, especially after we move to packages.Load (PR pending), which does all the parsing internally.

@longit644
Copy link
Contributor Author

No, directives are not retained within the comments. They are filtered out during the parsing process.

As for keeping the fork of AST, I agree that may not be the most efficient approach. Instead, we could consider re-implementing the directive check or exploring alternative solutions.

@thockin
Copy link
Member

thockin commented Jan 29, 2024

I don't object to the goal, but I think it's trickier with packages.Load - try from my v2 PR as a base?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants