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
Make provide's errors more expressive for fx.Annotate-ed functions #844
Conversation
Because of the use of reflection in fx.Annotate, the error messages for provide tend to refer to the annotated function as `"reflect".makeFuncStub` which is not helpful for debugging. This change updates error messages that previously looked like: ``` Failed: cannot provide function "reflect".makeFuncStub (/usr/local/go/src/reflect/asm_arm64.s:12): cannot provide *fx_test.Logger from [0].Field0: already provided by "reflect".makeFuncStub (/usr/local/go/src/reflect/asm_arm64.s:12) ``` To looking like this: ``` Failed: cannot provide function "reflect".makeFuncStub (/usr/local/go/src/reflect/asm_amd64.s:12): cannot provide *fx_test.Logger from [0].Field0: already provided by "go.uber.org/fx_test".TestAnnotate.func1 (/gocode/src/github.com/uber-go/fx/annotated_test.go:515) ``` WIP: Planning on making a future fix that gives a more readable name to the first function which still is referred to as "reflect".makeFuncStub after this change.
Codecov Report
@@ Coverage Diff @@
## master #844 +/- ##
==========================================
+ Coverage 98.45% 98.63% +0.18%
==========================================
Files 30 30
Lines 1098 1100 +2
==========================================
+ Hits 1081 1085 +4
+ Misses 11 10 -1
+ Partials 6 5 -1
Continue to review full report at Codecov.
|
Co-authored-by: Moises Vega <moises.vega@gmail.com>
Co-authored-by: Moises Vega <moises.vega@gmail.com>
Co-authored-by: Moises Vega <moises.vega@gmail.com>
Co-authored-by: Moises Vega <moises.vega@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please address the linter error before merging. Also it'd be nice if you can edit the commit message here to mention that the "other half" of the error message that wasn't fixed by this PR is due to an issue in Dig and will be addressed in follow-up work in Dig.
Because of the use of reflection in fx.Annotate, the error
messages for provide tend to refer to the annotated function as
"reflect".makeFuncStub
which is not helpful for debugging.This change updates error messages that previously looked like:
To looking like this:
WIP: Planning on making a future fix that gives a more
readable name to the first function which still is referred to
as "reflect".makeFuncStub after this change.