runtime/internal/clite/syscall: remove deps errors#1543
Conversation
Summary of ChangesHello @visualfc, 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 refactors the error handling mechanism within 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. 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 refactors the definition of common syscall errors, changing them from error variables to string constants. This is done to remove the errors package dependency from runtime/internal/clite/syscall. While the goal of reducing dependencies in low-level packages is understandable, the approach taken has significant drawbacks.
The core issue is that this change forces error checking to rely on string comparison (err.Error() == ...), which is a fragile and non-idiomatic pattern in Go. It makes the system brittle, as any future change to an error message will silently break error handling logic.
My review includes critical feedback on this architectural change, recommending a reversion to the standard practice of using sentinel error variables. This will restore the robustness and maintainability of the error handling code.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1543 +/- ##
=======================================
Coverage 91.00% 91.00%
=======================================
Files 45 45
Lines 11955 11955
=======================================
Hits 10880 10880
Misses 899 899
Partials 176 176 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
e2eb4f7 to
60240e9
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request refactors error handling in the syscall packages by changing many function signatures to return Errno instead of error. This is a good step towards centralizing error message generation and decoupling the low-level clite/syscall package. However, I've found a few critical issues that will cause compilation failures due to incorrect return values, and a couple of high-severity logic bugs related to error handling and unreachable code. Please address these points to ensure the correctness of the changes.
9a26b61 to
cc0b4af
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request refactors the syscall-related packages to remove dependencies and change the error handling strategy. The core change is that functions in runtime/internal/clite/syscall now return a numeric Errno instead of an error, which is a good practice for low-level packages to avoid allocations. The runtime/internal/lib/syscall package is updated to act as an adapter, converting these Errno values back into error types for higher-level consumers. The sentinel errors have also been moved to runtime/internal/lib/internal/oserror to break dependency cycles.
The changes are well-executed and consistent with the stated goal. I've found a couple of potential oversights related to this large refactoring:
- The
ErrUnsupportederror seems to have been dropped during the move of sentinel errors. - The
wasmimplementation oflib/syscall.Errnois missing theTemporary()andTimeout()methods, leading to an API inconsistency with theunixversion.
My detailed comments address these points. Overall, this is a good refactoring that improves the architecture of the syscall handling.
cc0b4af to
f43a8c4
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request refactors the syscall error handling by moving logic from the runtime/internal/clite/syscall package to the runtime/internal/lib/syscall and runtime/internal/lib/internal/oserror packages. The clite/syscall.Errno type no longer implements the error interface, making it a more primitive, C-like error code. The lib/syscall package now provides the Go error interface wrapper. This change is applied consistently across unix and wasm builds, and dependent packages are updated accordingly. The changes improve the layering and separation of concerns. The implementation appears correct and thorough.
|
/gemini summary |
Summary of ChangesThis pull request refactors the error handling mechanism within 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
|
runtime/internal/clite/syscall