gocast
gocast copied to clipboard
Avoid inits
Changes
- Closes #685
- [Worker]
cfg.Init()-->cfg.SetConfig()called incmd/worker.go - [TUM-Live]
config.Init()-->config.LoadConfig()called incmd/tumlive.go - [TUM-Live]
api.Init()-->api.ServeWorkerGRPC()called incmd/tumlive.go
Just had a look here out interest. The changes make sense to me, but I saw there are some more
inits()not addressed by this PR. Are these OK? I think they could be also potentially removed.
- This looks a bit problematic to me: https://github.com/joschahenningsen/TUM-Live/blob/095ca48c197349fcbcc06f8213d32912186d242e/tools/branding.go#L28
- This one could be fine: https://github.com/joschahenningsen/TUM-Live/blob/815492a680744efc568197e6cb626268313d0a69/tools/realtime/channel_store.go#L13
Ah these must have been added after the merge of some later pull requests. At least the branding one is new. I will remove those two too. 👍🏻
Just had a look here out interest. The changes make sense to me, but I saw there are some more
inits()not addressed by this PR. Are these OK? I think they could be also potentially removed.
- This looks a bit problematic to me: https://github.com/joschahenningsen/TUM-Live/blob/095ca48c197349fcbcc06f8213d32912186d242e/tools/branding.go#L28
- This one could be fine: https://github.com/joschahenningsen/TUM-Live/blob/815492a680744efc568197e6cb626268313d0a69/tools/realtime/channel_store.go#L13
Removed the branding init function. The second one doesn't is fine, yes.
I've also added a list of initializers and the function initAll in cmd/tumlive.go. initAll basically iterates the global variable initializers calls the function at the beginning of execution.