A Go package for controlling goroutine execution order based on dependencies, similar to async.auto in Node.js.
Goflow is a Go package that controls the execution order of goroutines based on dependencies, similar to async.auto in Node.js. It allows developers to define tasks with prerequisites, ensuring they run only when required dependencies have completed, which simplifies building complex concurrent workflows.
Go developers building applications with concurrent tasks that have interdependencies, such as data processing pipelines, orchestrated microservices, or multi-step asynchronous operations.
Developers choose Goflow for its minimal API and automatic dependency resolution, which reduces manual synchronization code and makes concurrent workflows more readable and maintainable compared to using raw goroutines and channels.
Simply way to control goroutines execution order based on dependencies
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
The Add() method accepts explicit dependency lists, allowing declarative task ordering that reduces manual goroutine synchronization code, as shown in the chainable API example.
Each task receives a map of results from its dependencies, simplifying data flow between goroutines without explicit channel handling, evidenced by the f4 function accessing results from f2 and f3.
The Do() method returns aggregated results and errors, enabling unified error management across all tasks, which is highlighted in the README's error handling feature.
With only New(), Add(), and Do() methods, the API is clean and intuitive, making it easy to adopt for developers familiar with Go's concurrency basics.
Results are passed as map[string]interface{}, requiring type assertions and losing Go's compile-time type safety, which can lead to runtime errors in complex workflows.
The README admits no built-in support for timeouts, cancellation, or retries, forcing developers to implement these manually for production-ready applications.
Using maps for result passing and linear dependency resolution may introduce overhead for very large or dynamic workflows, compared to lower-level channel-based approaches.