-
Notifications
You must be signed in to change notification settings - Fork 426
go: support overriding more pinned go module versions #2142
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
🔍 Suggested ReviewersBased on git blame analysis of the changed lines, the following contributors have significant experience with the modified code:
Please consider reviewing this PR as you have authored significant portions of the code being modified. Your expertise would be valuable! 🙏 This comment was automatically generated by git-blame-auto-reviewer Last updated: 2025-09-10T12:04:30.438Z |
Claude finished @sandydoo's task —— View job PR Review Complete ✅Reviewing PR #2142: go: support overriding more pinned go module versions Todo List:
Code Review Feedback🎯 Excellent Improvement - Regex-Based SolutionThe evolution from the first commit (hardcoded version checks) to the second commit (regex-based matching) is a significant improvement. The current implementation using 🔧 Areas for Improvement1. Regex Pattern Precision # Current: src/modules/languages/go.nix:14
goModuleArgs = lib.filterAttrs (name: _: lib.match "buildGo.*Module" name != null) overrideArgs; The regex
This prevents false positives if nixpkgs ever introduces unrelated attributes like 2. Performance Concern # src/modules/languages/go.nix:15
goModuleOverrides = lib.mapAttrs (_: _: buildGoModule) goModuleArgs; Every matched argument gets the same 3. Error Message Clarity # src/modules/languages/go.nix:21-25
throw ''
`languages.go` failed to override the Go version for ${pkg.pname or "unknown"}.
Expected to find a `buildGo*Module` argument in its override function.
Found: ${toString (lib.attrNames overrideArgs)}
''; The error message could be more actionable. Consider: throw ''
`languages.go` failed to override the Go version for ${pkg.pname or "unknown"}.
Expected to find a `buildGo*Module` argument (e.g., buildGoModule, buildGoLatestModule, buildGo123Module).
Available override arguments: ${toString (lib.attrNames overrideArgs)}
This package may need updates in nixpkgs to support Go version overriding.
''; 4. Test Coverage Gap
5. Documentation Enhancement # A helper function to rebuild a package with the specific Go version.
# It expects the package to have a `buildGo*Module` argument in its override function.
# Uses regex matching to find all buildGo*Module variants (buildGoModule, buildGo123Module, etc).
# This will override multiple buildGo*Module arguments if they exist. ✅ What Works Well
🏁 RecommendationThis is a solid improvement over the hardcoded approach. The main areas to address are:
The approach addresses @marcusramberg's regex suggestion effectively and solves the maintainability issues from the initial hardcoded implementation. |
Looks like most ci jobs fail |
Neat |
Did you consider using matches with a regex here to make it more future-proof? (get the overrideattrs as a list and use single after matching? |
Yes, I'm considering it. |
Fixes #2138.