cmd: fallback to parsing getent passwd output when $SHELL is not set#1760
cmd: fallback to parsing getent passwd output when $SHELL is not set#1760Rolv-Apneseth wants to merge 1 commit intocontainers:mainfrom
getent passwd output when $SHELL is not set#1760Conversation
Summary of ChangesHello @Rolv-Apneseth, 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 enhances the application's ability to reliably determine the user's default shell. It addresses scenarios where the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
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
|
There was a problem hiding this comment.
Code Review
This pull request adds a fallback mechanism to determine the user's shell by parsing getent passwd output when the $SHELL environment variable is not set. This is a good improvement for robustness. The changes are applied consistently across the create, enter, and rootMigrationPath commands. My review includes a couple of suggestions for the new getUserShell function in src/cmd/utils.go to enhance its portability and robustness. Additionally, since you've mentioned being open to adding tests, it would be great to add unit tests for the new getUserShell function to cover both the successful paths and the error cases you're handling. This would improve the long-term maintainability of this new logic.
8df9cb9 to
9c87365
Compare
Signed-off-by: Rolv Apneseth <rolv.apneseth@gmail.com> Signed-off-by: Rolv-Apneseth <rolv.apneseth@gmail.com>
9c87365 to
262de18
Compare
|
Build succeeded. ✔️ unit-test SUCCESS in 2m 10s |
As suggested in #1615, this PR just adds a fallback if $SHELL is not set for whatever reason.
Not very comfortable with Go, but hopefully the code is alright. Happy to make any changes anyway. And let me know if you want some tests added, I just wasn't sure entirely where to add that.