uber-go / dig

A reflection based dependency injection toolkit for Go.
https://go.uber.org/dig
MIT License
3.78k stars 206 forks source link

Stop Decorator Running When Dry Run Set #371

Closed JacobOaks closed 1 year ago

JacobOaks commented 1 year ago

Currently, decorators still run even when dry run is set in the container (see Fx issue: https://github.com/uber-go/fx/issues/1018)

This changes decorators to use the scope's invoker when decorating, causing it to fill-in zero-valued results instead of actually running the function when the dry run option is set.