Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make provide's errors more expressive for fx.Annotate-ed functions (#844
) * Make provide's errors more expressive for fx.Annotate-ed functions 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. * Switch to storing ptr value instead of ProvideOption Co-authored-by: Moises Vega <moises.vega@gmail.com> * Switch to storing ptr value instead of ProvideOption Co-authored-by: Moises Vega <moises.vega@gmail.com> * Switch to storing ptr value instead of ProvideOption Co-authored-by: Moises Vega <moises.vega@gmail.com> * Update annotated_test.go test naming Co-authored-by: Moises Vega <moises.vega@gmail.com> * Fix lint issue Co-authored-by: Moises Vega <moises.vega@gmail.com> Co-authored-by: Sung Yoon Whang <sungyoon@uber.com>
- Loading branch information