Skip to main content
Remy DI - Dependency Injection for Go
GitHub Go Docs Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

v1.11.0

Breaking Changes

  • Removed reflection options from Config: The Config struct no longer includes GenerifyInterfaces and UseReflectionType fields. These options have been completely removed from the library as part of a simplification effort.
  • Removed ReflectionOptions type: The ReflectionOptions type has been removed. All reflection-based functionality has been eliminated in favor of compile-time type safety.
  • GetWithPairs API change: GetWithPairs now uses the new BindEntry interface instead of InstancePairAny. The parameter order has also changed: keyTag is now the second parameter (before elements).
    • Before: GetWithPairs[T](retriever, elements []InstancePairAny, optTag ...string)
    • After: GetWithPairs[T](retriever, elements []BindEntry, optTag ...string)
  • GetWith parameter order change: The keyTag parameter is now required and comes before the binder function parameter in internal methods. The public API maintains backward compatibility with optional tags.
  • Removed deprecated functions: The remy_deprecated.go file and all deprecated function wrappers have been removed. If you were using deprecated functions, you must migrate to the new API.

Added

  • BindEntry interface: New interface for passing temporary dependencies to GetWithPairs. Provides a cleaner, type-safe API compared to the previous InstancePairAny struct.
    • NewBindEntry[T](value T) BindEntry: Creates a BindEntry with the given value and no tag
    • NewBindEntryTagged[T](value T, tag string) BindEntry: Creates a BindEntry with the given value and tag
  • Improved type key generation: Enhanced KeyElem with better ID generation using unsafe pointers for improved performance.

Changed / Improved

  • Internal method signatures: All internal injector methods now use keyTag string instead of optTag ...string for better clarity and consistency. The public API maintains backward compatibility.
  • Storage key validation: Storage now properly validates and checks for empty keys, preventing potential issues with uninitialized bind keys.
  • Performance improvements: Storage access has been optimized using unsafe pointers for better performance.

Refactor

  • Removed reflection dependencies: All reflection-based type key generation and type identification has been removed from the core library, improving compile-time safety and performance.
  • Simplified injector configuration: The Config struct is now simpler and more focused, removing complex reflection options that were rarely needed.
  • Updated examples: All examples have been updated to use the new BindEntry API and no longer reference reflection options.

Tests

  • Updated all injector tests to include keyTag in internal method calls
  • Added tests for the new BindEntry API
  • Tests adapted to work without reflection options