5 ms·
I've withdrawn my upvote after I saw this in the code: type Injector struct { values map[reflect.Type]interface{} customProviders map[reflec
by cyri 10y ago
I've withdrawn my upvote after I saw this in the code:
type Injector struct {
values map[reflect.Type]interface{}
customProviders map[reflect.Type]CustomProvideFunction
}
- komali2 10y agoI don't understand, what's wrong with that? I've never used Go so I'm asking out of ignorance.
- CSDude 10y agoIt is not type safe and relies on runtime reflection based checks to make it work correctly, it can crash easily. However, I believe I made all the checks correctly and it should work as intended, but of course it is only 600 LOC, there can arise some issues.
- bigblind 10y agoComments like this could be extremely helpful to the author if you explain more clearly what you mean. Is it because they're using reflection so much? Or is it because a CustomProvideFunction could also be stored as interface{} or something completely different? I'm fairly new to Go as well, so I'm curious.