Dig Versions Save

A reflection based dependency injection toolkit for Go.

v1.17.1

6 months ago

Added

  • Suggestions for value vs. pointer elements for slice and array types.

Fixed

  • An issue where value group values were not getting decorated by decorators within the same module when using dig.Export(true).
  • A typo in docs.
  • An issue where false positives in cycle detection were occurring when providing to a child scope.

Thanks to @paullen and @lcarilla for their contributions to this release.

v1.17.0

11 months ago

Added

  • Allow using dig.As with dig.Group.
  • Add FillInvokeInfo Option and InvokeInfo struct to help extract the types requested by an Invoke statement.
  • To get visibility into constructor and decorator calls, introduce WithProviderCallback and WithDecoratorCallback Options to provide callback functions.

v1.16.1

1 year ago

Fixed

  • A panic when DryRun was used with Decorate.

v1.16.0

1 year ago

Added

  • Add RecoverFromPanics option, which provides panic-recovery mechanism for Container.
  • Add Error interface which enables distinguishing errors from Dig using standard errors package.

Thanks to @mie998 for their contribution(s) to this release.

v1.15.0

1 year ago

Added

  • Support for soft value groups, which specify a value group that only gets populated with values from already-executed constructors.

Fixed

  • Fix an issue with invoke order affecting results provided by private provides.

Thanks to @hbdf for their contributions to this release.

v1.14.1

2 years ago

Fixed

  • Fix an issue where a dependency for a decoration supplied by another decorator in the same scope is ignored.
  • Fix a panic when submitting a single value as a value group in Scope.Decorate.
  • Upon a provide error, make the error message contain the function named specified by LocationForPC Option.

v1.14.0

2 years ago

Added

  • Introduce dig.Scope which creates a scoped dependency injection container to scope dependencies.
  • Introduce Scope.Decorate and Container.Decorate which allows a decorator to modify a dependency already provided in the dependency graph.
  • Add FillDecorateInfo Option and DecorateInfo struct which exposes information on what Dig was able to understand from the decorator provided with Scope.Decorate or Container.Decorate.

Changed

  • The error message that appears when a cycle is detected in the dependency graph has been changed slightly.

Fixed

  • A stack overflow bug that happens when cycles are introduced via self-pointing dependencies with DeferAcyclicVerification.

v1.13.0

2 years ago

Added

  • Introduce As option which supports providing a type as interface(s) it implements to the container.
  • Add LocationForPC option which overrides the function inspection for a program counter address to a provided function info.

v1.12.0

2 years ago

Added

  • Support for ProvideInfo and FillProvideInfo that allow the caller of Provide to get info about what dig understood from the constructor.

v1.11.0

2 years ago

Added

  • Support unexported fields on dig.In structs with the ignore-unexported:"true struct tag.