Skip to content
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

Add validation feature, Add benchmark #5

Merged
merged 4 commits into from
Nov 9, 2024

Conversation

duongphuhiep
Copy link
Collaborator

@duongphuhiep duongphuhiep commented Nov 7, 2024

  1. Detect circular dependency: panic with a human readable message instead of Big unreadable stack overflow (can give more info on the circular deps in the future)

  2. Panic on Lifetime misalignment (when a longer lifetime depends on a Shorter lifetime)

  3. Add ore.Validate() invokes ALL your registered resolvers, it panics when something gone wrong. The purpose of this function is to panic early (on the test pipeline or application startup) when the Container is bad configured:

    • Missing dependency: when user forgot to register certain resolvers.
    • Circular dependency: A depends on B which depends on A.
    • Lifetime misalignment: a longer lifetime service (eg. Singleton) depends on a shorter one (eg Transient).
  4. Add benchmark to compare with Samber/Do

- handle circular DI: panic with a nice error instead of call stack overflow
- detect lifetime misalignment to panic
- add ore.validate() func to panic early if the container is bad configured
@duongphuhiep duongphuhiep force-pushed the main branch 2 times, most recently from d0252cd to fe0444e Compare November 7, 2024 17:53
@duongphuhiep
Copy link
Collaborator Author

hmm, on my machine, all test is green, I'm unable to make the test failed as in the pipeline, not sure where is the problem :-(

@duongphuhiep
Copy link
Collaborator Author

fixed, time.Now() on Windows and on Linux is sligtly different

Repository owner deleted a comment from sonarqubecloud bot Nov 7, 2024
Copy link

sonarqubecloud bot commented Nov 8, 2024

@firasdarwish
Copy link
Owner

thank you for your invaluable contributions @duongphuhiep

@firasdarwish firasdarwish merged commit 1eaaae7 into firasdarwish:main Nov 9, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants