-
Notifications
You must be signed in to change notification settings - Fork 15
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
Ensure that imports are not removed in generated code #406
Conversation
Makes it such that the "ptimports.Process" call on generated code does not add or remove imports. Fixes an issue where generated code would not include imports that referenced packages where the last component of the package path was of the form "v[0-9]+". Fixes #405
Generate changelog in
|
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.
Reviewed 1 of 1 files at r1, 6 of 6 files at r2, 1 of 1 files at r3, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @tabboud)
…#408) Reverts the conjure-go behavior change introduced in v6.36.0 to match previous versions: certain named imports generated by Conjure code will only be generated if the Conjure generator is run twice, but once this is done, the output of `conjure.Generate` and `conjure.GenerateOutputFiles` will match, which prevents verification issues.
Makes it such that the "ptimports.Process" call that is called for individual generated code files does not add or remove imports and then adds a step where "ptimports.Process" is called on all generated code files after they are written. Fixes an issue where generated code would not include imports that referenced packages where the last component of the package path was of the form "v[0-9]+".
Fixes #405
Before this PR
See #405 for details, but before this PR, generating code for Conjure definitions that have packages where the last component is of the form
v[0-9]+
(for example, "com.palantir.foo.v2") would not generate the import statement needed to compile (so the first run of the generator would produce code that didn't compile). Running the generator a second time would add the expected imports.After this PR
==COMMIT_MSG==
Fixes an issue where generated code would not include imports that referenced packages where the last component of the package path was of the form "v[0-9]+".
==COMMIT_MSG==
Possible downsides?
This fix adds a step where, after all the generated files are written, they are all formatted and written again. This process adds computational overhead on the order of the number of files written, but I don't think it should be a major concern as the operation is not too expensive and generating the files is not a hot path (it's an operation that is expected to take a decent amount of time and is run in a one-off manner in workflows).
This change is