feat: ora funge tutto benissimo per qualche motivo

This commit is contained in:
2023-02-02 01:25:12 +01:00
parent be57412c40
commit 2b47950556
20 changed files with 890 additions and 108 deletions
+7 -1
View File
@@ -28,6 +28,7 @@ func (s *slot) checkInitialized(l *ServiceLocator) error {
log.Printf(`initialized lazy value of type %T for slot of type %s`, v, s.typ)
s.created = true
s.value = v
}
@@ -47,7 +48,12 @@ func New() *ServiceLocator {
func InjectValue[T any](l *ServiceLocator, slotKey SlotKey[T], value T) T {
log.Printf(`injected value of type %T for slot of type %s`, value, getTypeName[T]())
l.providers[slotKey] = &slot{nil, true, value, getTypeName[T]()}
l.providers[slotKey] = &slot{
nil,
true,
value,
getTypeName[T](),
}
return value
}