Conversation
|
|
||
| } else if (sf.Type.Kind() == reflect.Ptr || sf.Type.Kind() == reflect.Interface) && rv.Field(i).IsNil() { | ||
| panic(tagMissingError{field: sf}) | ||
| // Is this required |
There was a problem hiding this comment.
Trying to use an external library where wire:"-" can't be added, so is more of a question :)
There was a problem hiding this comment.
This is for validation purpose, to ensure all dependency is properly added and connected.
Hmm, I never consider the case where external library might have nil pointer or interface.
How if we add another variant of Connect function that allows bypassing this check?
|
|
||
| } else if (sf.Type.Kind() == reflect.Ptr || sf.Type.Kind() == reflect.Interface) && rv.Field(i).IsNil() { | ||
| panic(tagMissingError{field: sf}) | ||
| // Is this required |
There was a problem hiding this comment.
This is for validation purpose, to ensure all dependency is properly added and connected.
Hmm, I never consider the case where external library might have nil pointer or interface.
How if we add another variant of Connect function that allows bypassing this check?
| container.components[rt] = append(container.components[rt], comp) | ||
| return | ||
| } | ||
| dependinces := make([]dependency, 0) |
There was a problem hiding this comment.
isn't this supposed to be dependencies?
https://www.collinsdictionary.com/dictionary/english/dependencies
|
|
||
| // Apply wiring to all components. | ||
| func (container Container) Apply() { | ||
| func (container Container) Apply(to ...interface{}) { |
There was a problem hiding this comment.
interesting, this allows components added directly in apply function right?
|
|
||
| container.fill(comp) | ||
|
|
||
| return |
There was a problem hiding this comment.
why do we need to return here? this will cause other components that connected using Connect to be not added right?
No description provided.