-
Notifications
You must be signed in to change notification settings - Fork 39.9k
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
gengo performance: Speed up update-codegen.sh by switching to FormatOnly in gengo #127011
Conversation
LGTM label has been added. Git tree hash: 80a4306af57ec10c22e7574d3b301fa5369be70d
|
Ouch. There's no good answer here, is there. I guess this is a better result, so if we're going to churn, this seems overall preferable. /approve |
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.
missed sending this
@@ -213,7 +213,6 @@ func (g *listerGenerator) Namers(c *generator.Context) namer.NameSystems { | |||
|
|||
func (g *listerGenerator) Imports(c *generator.Context) (imports []string) { | |||
imports = append(imports, g.imports.ImportLines()...) | |||
imports = append(imports, "k8s.io/apimachinery/pkg/api/errors") | |||
imports = append(imports, "k8s.io/apimachinery/pkg/labels") |
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.
Shouldn't these also disappear if we are being explicit everywhere?
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.
mea culpa. I saw these in passing but didn't clean them up. I can do that now.
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.
Fixed.
/hold |
10e0a35
to
b14b6dc
Compare
/hold cancel |
…t generation of import to package being generated Co-authored-by: Tim Hockin <thockin@google.com>
@jpbetz: The following tests failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. 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. I understand the commands that are listed here. |
b14b6dc
to
2595aa1
Compare
This PR may require API review. If so, when the changes are ready, complete the pre-review checklist and request an API review. Status of requested reviews is tracked in the API Review project. |
/triage accepted |
Thanks! /lgtm |
LGTM label has been added. Git tree hash: b34028ab5ea762e475779de1fa0f0153c224ecc0
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jpbetz, thockin The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@@ -115,7 +115,7 @@ func GetTargets(context *generator.Context, args *args.Args) []generator.Target | |||
gv: gv, | |||
typesToGenerate: typesToRegister, | |||
outputPackage: pkg.Path, | |||
imports: generator.NewImportTracker(), | |||
imports: generator.NewImportTrackerForPackage(pkg.Path), |
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.
xref breakage in register-gen associated with this gengo bump... #129290
unnoticed because nothing in-tree apparently uses register-gen
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
Which issue(s) this PR fixes:
Avoid expensive per-target calls out to goimports from gengo.
This improve codegen update and verify times by about 25%.
Special notes for your reviewer:
This is based on f63343f from @thockin.
This depends on a gengo/v2 change: kubernetes/gengo#277
The main changes here are to fix sloppy import handling that was masked by gengo's import fixup, disable gengo's import fix up with kubernetes/gengo#277, and then generate with the import name changes that result.
The main import changes are:
v1
package would import a types package using thev1
package alias. This is legal go code, but is less clear than an import likecorev1
ormetav1
, so we've added a rule that imported type aliases must not match the local package alias exactly.fmt "fmt"
. We could further change gengo to avoid redundant import aliases, but for this change we're just switching the codegen to be consistent for all types, using gengo's conventions, instead of a mix or gengo and goimport conventions.Does this PR introduce a user-facing change?
/sig api-machinery
/assign @thockin @skitt