Conversation
hwbrzzl
commented
Jun 30, 2025
| for _, provider := range providers { | ||
| if !used[provider] { | ||
| sortedProviders = append([]foundation.ServiceProvider{provider}, sortedProviders...) | ||
| sortedProviders = append(sortedProviders, provider) |
Contributor
Author
There was a problem hiding this comment.
The providers that don't set a relationship will be set to the bottom.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1102 +/- ##
==========================================
+ Coverage 71.09% 71.15% +0.06%
==========================================
Files 185 185
Lines 13183 13213 +30
==========================================
+ Hits 9372 9402 +30
Misses 3441 3441
Partials 370 370 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📑 Description
Closes goravel/goravel#667
Previously, there is an issue if a provider didn't set a relationship.
This pull request introduces enhancements to the
foundation/application.gofile by improving the handling of service provider dependencies and bindings, as well as adding comprehensive test cases to validate these changes. The most significant updates include the introduction of virtual bindings for providers without explicit bindings, improved dependency graph construction, and new test scenarios to ensure correctness and robustness.Enhancements to service provider dependency handling:
foundation/application.go)foundation/application.go) [1] [2]Debugging and testing improvements:
debug.Dumpto output the configured service providers for easier debugging. (foundation/application.go)foundation/application_test.go) [1] [2] [3]isTopologicalOrderto ensure that the sorted providers maintain a valid topological order. This is used in test cases to verify correctness. (foundation/application_test.go)These changes improve the robustness and maintainability of the service provider sorting mechanism, ensuring proper handling of complex dependency scenarios while providing better debugging and testing capabilities.
✅ Checks