I think this is more a question of logic than myself. I want to find a way to accomplish a task based on its dependencies in go.

Given the workflow above: Jobs 1,2,3 and 4 can be run asynchronously at the same time. Task 10 will be completed after tasks 1 and 2 are completed. Task 11 will be completed when task 3 and 4 are completed. Task 12 will be completed when tasks 11 and 12 are completed. Task 100 will be completed when tasks 10 and 11 are completed.
I use go channels to run parallel executions and want to find an efficient way to manage dependencies. I know that I may have some kind of flag and a table for controlling execution, but ideally I would like to do this in memory to avoid database calls to manage such a thing. I also understand that there are several ways to do this, but I would like to hear your ideas, because I'm sure there is a better way to do than the ways that I could come up with so far.
source share