-
Notifications
You must be signed in to change notification settings - Fork 68
chore(librariangen): Generate to use languagecontainer.Run #3968
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
Conversation
Summary of ChangesHello @suztomo, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly refactors the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
| ) | ||
|
|
||
| // Config holds the internal librariangen configuration for the generate command. | ||
| type Config struct { |
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.
This has moved to languagecontainer.Context.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3968 +/- ##
==========================================
+ Coverage 78.89% 82.05% +3.16%
==========================================
Files 8 9 +1
Lines 379 379
==========================================
+ Hits 299 311 +12
+ Misses 53 41 -12
Partials 27 27
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| // readGenerateReq reads generate-request.json from the librarian-tool input directory. | ||
| // The request file tells librariangen which library and APIs to generate. | ||
| // It is prepared by the Librarian tool and mounted at /librarian. | ||
| func readGenerateReq(librarianDir string) (*message.Library, 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.
This has moved to languagecontainer.generate.NewConfig.
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.
Code Review
This pull request introduces the use of languagecontainer.Run for the generate command, refactors the Generate function to use a generate.Config struct, and adds a new generate package with Context and Config types. The changes also include updates to tests and the main entry point to accommodate the new structure. The review focuses on ensuring the correctness of the new implementation, proper error handling, and adherence to good coding practices.
internal/librariangen/languagecontainer/languagecontainer_test.go
Outdated
Show resolved
Hide resolved
| } | ||
|
|
||
| // handleGenerate parses flags for the generate command and calls the generator. | ||
| func handleGenerate(ctx context.Context, args []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.
This moved to languagecontainer package.
meltsufin
left a comment
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.
This is conflicting a lot with #3967. Can you please make the change in two separate PRs.
- changes to main.go
- changes to
generator.go
|
@meltsufin I couldn't think of a good way to split it. |
|
@meltsufin I merged the main branch. PTAL. |
This pull requests changes the argument parsing/validation logic of the generate command to languagecontainer package. The corresponding test cases have been moved to the languagecontainer package as well.
As a result, the main.go and main_test.go became simpler.
Test to confirm the generate function is called