feat: add function runtime to dig.CallbackInfo
This change adds runtime of the associated constructor
or decorator to dig.CallbackInfo.
For example, users can access the runtime of a particular constructor by:
c := dig.New()
c.Provide(NewFoo, dig.WithProviderCallback(func(ci dig.CallbackInfo) {
if ci.Error == nil {
fmt.Printf("constructor %q finished running in %v", ci.Name, ci.Runtime)
}
}))
This change is a prerequisite for adding https://github.com/uber-go/fx/issues/1213 to report runtime of constructors in Run events.
Codecov Report
Attention: Patch coverage is 95.23810% with 1 line in your changes missing coverage. Please review.
Project coverage is 98.35%. Comparing base (
897df36) to head (1ed1d62). Report is 1 commits behind head on master.
:exclamation: Current head 1ed1d62 differs from pull request most recent head 26d26ec
Please upload reports for the commit 26d26ec to get more accurate results.
| Files | Patch % | Lines |
|---|---|---|
| container.go | 66.66% | 1 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## master #412 +/- ##
==========================================
- Coverage 98.40% 98.35% -0.05%
==========================================
Files 22 23 +1
Lines 1507 1524 +17
==========================================
+ Hits 1483 1499 +16
- Misses 15 16 +1
Partials 9 9
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.