refactor: replace go-multierror with stdlib, remove dep - #705
Conversation
WalkthroughRemoves the ChangesReplace go-multierror with stdlib errors.Join
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Possibly related issues
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Draft because we will bump the openfga/language/pkg/go too to remove the transitive dependency |
52068f8 to
e009bac
Compare
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
There was a problem hiding this comment.
✅ Ready to approve
The change cleanly replaces the only go-multierror usage with errors.Join() and the dependency removals in go.mod/go.sum align with the refactor.
Note: this review does not count toward required approvals for merging.
Pull request overview
This PR removes the github.com/hashicorp/go-multierror dependency from the CLI by switching the remaining multi-error accumulation logic to Go’s standard library errors.Join, and tidying module dependencies accordingly.
Changes:
- Replaced
go-multierrorusage with a[]erroraccumulator anderrors.Join()in modular model loading. - Removed
github.com/hashicorp/go-multierror(and the indirectgithub.com/hashicorp/errwrap) from module dependencies. - Updated
github.com/openfga/language/pkg/gofromv0.2.1tov0.3.0as part of dependency cleanup/tidy.
File summaries
| File | Description |
|---|---|
| internal/authorizationmodel/model.go | Replaces multierror aggregation with []error + errors.Join() when reading modular model files. |
| go.mod | Drops go-multierror / errwrap and bumps openfga/language/pkg/go to v0.3.0. |
| go.sum | Removes go-multierror and errwrap checksums and updates checksums for the bumped language module. |
Copilot's findings
- Files reviewed: 2/3 changed files
- Comments generated: 0
Note
Your feedback helps us improve the quality of this feature.
Please use 👍 or 👎 to tell us whether this assessment is correct.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
go.mod (1)
16-16: ⚡ Quick winSync depguard allowlist with the dependency removal objective.
Line 16 completes the language package bump, but
.golangci.yamlstill allowsgithub.com/hashicorp/go-multierror. Removing it from the depguard allowlist would keep lint policy aligned and prevent accidental reintroduction.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@go.mod` at line 16, The language package dependency has been bumped in go.mod, but the depguard allowlist in .golangci.yaml still permits github.com/hashicorp/go-multierror, which should have been removed as part of the dependency removal objective. Update .golangci.yaml to remove the github.com/hashicorp/go-multierror entry from the depguard allowlist to ensure the lint policy stays synchronized with the actual dependencies and prevents accidental reintroduction of the removed package.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@go.mod`:
- Line 16: The language package dependency has been bumped in go.mod, but the
depguard allowlist in .golangci.yaml still permits
github.com/hashicorp/go-multierror, which should have been removed as part of
the dependency removal objective. Update .golangci.yaml to remove the
github.com/hashicorp/go-multierror entry from the depguard allowlist to ensure
the lint policy stays synchronized with the actual dependencies and prevents
accidental reintroduction of the removed package.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 4bf07598-1620-4720-bf17-93ffad91d8c3
⛔ Files ignored due to path filters (1)
go.sumis excluded by!**/*.sum
📒 Files selected for processing (2)
go.modinternal/authorizationmodel/model.go
Description
For #673
What problem is being solved?
How is it being solved?
What changes are made to solve it?
References
Review Checklist
mainSummary by CodeRabbit