Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bubble location from LocationForPC's ProvideOption up to errors (#332)
Previously, if a location was passed to Provide via the LocationForPC ProvideOption, the location would not be taken into account in the case of an error where a constructor could not be Provided. This change updates the error returned, making it more readable by basing the error message on alternate function provided by LocationForPC rather than the constructor. For example, the following error: ``` Failed: cannot provide function "reflect".makeFuncStub (/usr/local/Cellar/go/1.17.6/libexec/src/reflect/asm_amd64.s:30): cannot provide *fx_test.a[name="a"] from [0].Field0: already provided by "go.uber.org/fx_test".TestAnnotate.func1 (/gocode/src/github.com/uber-go/fx/annotated_test.go:515) ``` Becomes: ``` Failed: cannot provide function "go.uber.org/fx_test".TestAnnotate.func1 (/gocode/src/github.com/uber-go/fx/annotated_test.go:515): cannot provide *fx_test.a[name="a"] from [0].Field0: already provided by "go.uber.org/fx_test".TestAnnotate.func1 (/gocode/src/github.com/uber-go/fx/annotated_test.go:515) ``` Co-authored-by: Sung Yoon Whang <sungyoon@uber.com>
- Loading branch information