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

Make provide's errors more expressive for fx.Annotate-ed functions #844

Merged
merged 7 commits into from Feb 22, 2022

Commits on Feb 18, 2022

  1. 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.
    josephinedotlee committed Feb 18, 2022
    Copy the full SHA
    412e0c7 View commit details
    Browse the repository at this point in the history
  2. Switch to storing ptr value instead of ProvideOption

    Co-authored-by: Moises Vega <moises.vega@gmail.com>
    josephinedotlee and moisesvega committed Feb 18, 2022
    Copy the full SHA
    84816eb View commit details
    Browse the repository at this point in the history
  3. Switch to storing ptr value instead of ProvideOption

    Co-authored-by: Moises Vega <moises.vega@gmail.com>
    josephinedotlee and moisesvega committed Feb 18, 2022
    Copy the full SHA
    cc05576 View commit details
    Browse the repository at this point in the history
  4. Switch to storing ptr value instead of ProvideOption

    Co-authored-by: Moises Vega <moises.vega@gmail.com>
    josephinedotlee and moisesvega committed Feb 18, 2022
    Copy the full SHA
    d536055 View commit details
    Browse the repository at this point in the history
  5. Update annotated_test.go test naming

    Co-authored-by: Moises Vega <moises.vega@gmail.com>
    josephinedotlee and moisesvega committed Feb 18, 2022
    Copy the full SHA
    3342cc1 View commit details
    Browse the repository at this point in the history

Commits on Feb 22, 2022

  1. Copy the full SHA
    a2102d0 View commit details
    Browse the repository at this point in the history
  2. Fix lint issue

    sywhang committed Feb 22, 2022
    Copy the full SHA
    8ee7e13 View commit details
    Browse the repository at this point in the history