-
Notifications
You must be signed in to change notification settings - Fork 417
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
Generated files should follow golang standard for machine-generated files to avoid golint issues #30
Comments
Related kubernetes/kubernetes#56489. |
@mattkelly Does "<generator-name>" mean "deepcopy-gen", "conversion-gen", etc? |
@jennybuckley yup, that's what I was picturing. That looks good to me! |
/close |
/reopen the defaulter still has some linter problems. it generates function names with underscores e.g. see the discussion here: |
@neolit123: Reopened this issue. In response to this:
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. |
Currently |
also we have to note that fixing the underscores will result in code that no longer passes /hack verification. |
That's why I propose an option to the generators, that can enable this behavior (so that we don't have to fix everything). |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/remove-lifecycle stale |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/lifecycle frozen |
Revisiting long-lost issues. It's true that conversion-gen expects manually-written conversions to be named like Instead of
It's not exactly obvious, because there are 3 packages in play, but I think it could be done. Defaulting would be even easier. |
Overview
Files generated by
code-generator
currently have a lot of issues picked up bygolint
. There are a few options to fix this:golint
automatically skips themProposed Solution
I propose that we add the following comment line just below the boilerplate header:
There are already lines similar to this generated but they do not match the desired regex, so we can just modify them. For example: https://github.com/kubernetes/kubernetes/search?utf8=✓&q=%22Do+not+edit+it+manually%22&type=Code.
After some quick poking around, this will require modifying not only
code-generator
but also kubernetes/gengo for example.I've tested manually editing an auto-generated file to add this line and it does result in
golint
ignoring the file as expected.I'm not very familiar with the process for auto-generated code in Kubernetes itself - would we want to re-generate all of the generated code as part of the PR for this issue?
I'm happy to take this on this weekend if we feel that it's a good solution.
The text was updated successfully, but these errors were encountered: