You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Our in-house dependency injection framework has some flaws with the order of initialization and inter-module dependencies. Take a look at this example from the PR #107:
go run cmd/migrate/main.go up
panic: ERROR: relation "users" does not exist (SQLSTATE 42P01) handling infrastructure/persistence/schema/bichat-schema.sql
goroutine 1 [running]:
main.main()
/iota-sdk/cmd/migrate/main.go:11 +0x50
exit status 2
As you can see there can even be implicit dependencies which needs to be annotated by hand (meaning we can't infer this using just Go's type system).
This is not intuitive, nor type-safe, which makes it flawed and leads to future frustrations and wasted time debugging.
The problem is - dependencies really are a graph but we're treating them as some linear structure (combination of a Type->Serivce map + varargs). It would be okay if services didn't depend on each other, but that is not the case and really is not possible in our program of this scale and complexity. Also, I was not able to find a way to specify the order of dependencies to resolve the above issue with SQL schema dependency of dialogs to users. Even though .NewModules are called in the correct order the initialization isn't in that order:
Our in-house dependency injection framework has some flaws with the order of initialization and inter-module dependencies. Take a look at this example from the PR #107:
Doesn't work:
Fails with:
Works (kinda):
Fails with:
As you can see there can even be implicit dependencies which needs to be annotated by hand (meaning we can't infer this using just Go's type system).
This is not intuitive, nor type-safe, which makes it flawed and leads to future frustrations and wasted time debugging.
The problem is - dependencies really are a graph but we're treating them as some linear structure (combination of a Type->Serivce map + varargs). It would be okay if services didn't depend on each other, but that is not the case and really is not possible in our program of this scale and complexity. Also, I was not able to find a way to specify the order of dependencies to resolve the above issue with SQL schema dependency of
dialogs
tousers
. Even though.NewModule
s are called in the correct order the initialization isn't in that order:The text was updated successfully, but these errors were encountered: