go-actor examples

April 2, 2026 ยท View on GitHub

test lint

This repository hosts various examples for go-actor.

How to use examples

To make the most out of these examples, read each example package found in the /example directory. Every example has a bootstrap.go file that sets up the logic and explains the idea behind the example. It is also advised to read other source files in the example directory (package).

Each example can be executed with the following command:

make run 1  # replace 1 with the desired example number
ExampleDescription
1Demonstrates how to create actors for a producer-consumer use case.
2Demonstrates how to fan-out a mailbox (an example with multiple consumers).
3Demonstrates how to create actors with options.
4An improved Countdown actor, building on example 3.
5Demonstrates when a producer-consumer case should end based on a specific condition.
6Builds on example 5, fixing an introduced issue (and puzzle).
7A small improvement to example 6.
8Explores a scenario where the producer is much faster than the consumer; introduces a new puzzle.
9Provides the solution to the puzzle introduced in example 8.
10Demonstrates how to stop a combined actor when the first actor ends.
11Demonstrates how to create a custom actor (HTTPService) and seamlessly compose it with other actors.

Contribution

All contributions are useful, whether it is a simple typo, a more complex change, or just pointing out an issue. We welcome any contribution so feel free to open a PR or issue.