Hugo 1.3.5
See the version list below for details.
dotnet add package Hugo --version 1.3.5
NuGet\Install-Package Hugo -Version 1.3.5
<PackageReference Include="Hugo" Version="1.3.5" />
<PackageVersion Include="Hugo" Version="1.3.5" />
<PackageReference Include="Hugo" />
paket add Hugo --version 1.3.5
#r "nuget: Hugo, 1.3.5"
#:package Hugo@1.3.5
#addin nuget:?package=Hugo&version=1.3.5
#tool nuget:?package=Hugo&version=1.3.5
Hugo
Go-style concurrency primitives and functional result pipelines for .NET 9/10 applications.
Overview
Hugo brings Go-inspired building blocks—channels, wait groups, mutexes, timers, and defer—to the .NET runtime while embracing railway-oriented programming for error handling. The library ships with observability hooks, prioritised channels, and integration helpers designed to keep asynchronous code predictable, testable, and composable.
- Structured docs: Tutorials, how-to guides, reference, and explanations live under
docs/index.md. - Deterministic concurrency:
WaitGroup,Mutex,RwMutex, andSelectAsyncmirror Go semantics while honouring cancellation tokens andTimeProvider. - Functional results:
Result<T>pipelines keep happy-path code linear and report failures with structured metadata. - Observability ready:
GoDiagnosticsexposes counters and histograms that plug straight into OpenTelemetry exporters. - Benchmarks & samples:
benchmarks/Hugo.Benchmarkscompares primitives under load;samples/Hugo.WorkerSampleshows structured background work.
Compatibility
- Targets
net9.0andnet10.0. - Plays nicely with host builders, ASP.NET background services, and worker services.
- Tested with the .NET 10 preview SDK; install alongside .NET 9 for full coverage.
Installation
dotnet add package Hugo
- Works seamlessly with central package management (
Directory.Packages.props). - To experiment locally, run
dotnet pack src/Hugo/Hugo.csproj -o ./artifactsand reference the generated.nupkgfrom a local feed.
Quickstart
using Hugo;
using static Hugo.Go;
var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5));
var channel = MakeChannel<string>(capacity: 4);
var workers = new WaitGroup();
workers.Go(async () =>
{
using var scope = Defer(() => channel.Writer.TryComplete());
await channel.Writer.WriteAsync("hello", cts.Token);
await channel.Writer.WriteAsync("world", cts.Token);
});
var messages = new List<string>();
while (await channel.Reader.WaitToReadAsync(cts.Token))
{
if (channel.Reader.TryRead(out var value))
{
var result = Ok(value)
.Ensure(static text => !string.IsNullOrWhiteSpace(text))
.Map(static text => text.ToUpperInvariant());
if (result.IsSuccess)
{
messages.Add(result.Value);
}
}
}
await workers.WaitAsync(cts.Token);
Console.WriteLine(string.Join(' ', messages));
Key Features
- Go primitives for .NET: Wait groups, mutexes, RW locks, prioritized channels, deferred cleanup, and select-style coordination.
- Railway-oriented results:
Result<T>pipelines withThen,Map,Recover,Ensure,Tap, and friends for deterministic error handling. - Observability hooks: Metered counters and histograms via
GoDiagnosticsfor wait-group activity, result creation, and channel select latency. - Cancellation-first design: All asynchronous APIs accept
CancellationToken, wrap cancellations consistently, and surfaceError.Canceledin pipelines.
Documentation
- Documentation index: entry point for tutorials, how-to guides, reference, and explanations.
- Getting started tutorial: build a minimal worker with channels and results.
- Fan-in how-to: merge multiple readers with cancellation and deadlines.
- OpenTelemetry how-to: export
GoDiagnosticsmetrics. - Concurrency primitives reference.
- Result pipeline reference.
- Design principles.
Samples & Benchmarks
samples/Hugo.WorkerSample: Background worker demonstrating task leasing withTaskQueue<T>plus wait groups and deferred cleanup.
Run the worker sample with a local OpenTelemetry collector
Save the collector config below as
otel-collector.yamlin the repository root:receivers: otlp: protocols: grpc: http: exporters: logging: loglevel: info prometheus: endpoint: "0.0.0.0:9464" service: pipelines: metrics: receivers: [otlp] exporters: [prometheus, logging] traces: receivers: [otlp] exporters: [logging]Start the collector (requires Docker):
docker run --rm \ -p 4317:4317 -p 4318:4318 -p 9464:9464 \ -v "${PWD}/otel-collector.yaml:/etc/otelcol/config.yaml" \ otel/opentelemetry-collector:0.103.1In a second terminal, run the worker sample:
dotnet run --project samples/Hugo.WorkerSample/Hugo.WorkerSample.csproj- Override the collector endpoint with
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317if you change ports. - Disable Prometheus scraping with
HUGO_PROMETHEUS_ENABLED=falsewhen running without the Prometheus exporter.
- Override the collector endpoint with
Inspect emitted metrics at
http://localhost:9464/metricsand watch the collector logs for OTLP traces.
Benchmarks
The benchmarks/Hugo.Benchmarks directory contains a comprehensive BenchmarkDotNet suite comparing Hugo primitives against native .NET equivalents:
- Mutex vs SemaphoreSlim: Lock acquisition and release performance
- RwMutex: Read/write lock contention scenarios
- Once: One-time initialization patterns
- Pool: Object pooling efficiency
- Channel factories: Bounded vs unbounded channel creation
- Prioritized channels: Multi-level priority queue throughput
- Result pipelines: Railway-oriented composition overhead
- Select operations: Channel coordination latency
Run benchmarks locally:
dotnet run --project benchmarks/Hugo.Benchmarks/Hugo.Benchmarks.csproj -c Release
Generated reports are available in BenchmarkDotNet.Artifacts/results/. Hugo primitives demonstrate competitive performance with native .NET types while providing additional safety guarantees and observability hooks.
Support & policies
- Questions & bugs: GitHub issues
- Security disclosures: contact the maintainer privately before filing a public issue.
- Roadmap: keep up with priorities in
docs/meta/roadmap.md.
Contributing
Contributions are welcome! See CONTRIBUTING.md for detailed guidelines on:
- Setting up your development environment
- Code style and conventions
- Running tests and collecting coverage
- Submitting pull requests
- Documentation updates
Quick start:
- Install the .NET 10 preview SDK alongside .NET 9.
- Run
dotnet build Hugo.slnxanddotnet test tests/Hugo.Tests/Hugo.Tests.csprojbefore submitting changes. - Collect coverage locally with
dotnet test tests/Hugo.Tests/Hugo.Tests.csproj --collect:"XPlat Code Coverage"to mirror CI. - Review
docs/index.mdto update tutorials, how-to guides, and references when behaviour changes. - Track strategic work in
docs/meta/roadmap.mdand ensure new APIs include XML docs plus cancellation coverage tests.
License
Hugo is licensed under the MIT License. You are free to use, modify, and distribute this library in accordance with the license terms.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.10)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.10)
-
net9.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.10)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.10)
NuGet packages (7)
Showing the top 5 NuGet packages that depend on Hugo:
| Package | Downloads |
|---|---|
|
Hugo.Diagnostics.OpenTelemetry
OpenTelemetry extensions and defaults for Hugo diagnostics instrumentation. |
|
|
Hugo.TaskQueues.Replication
Replication helpers, deterministic coordinators, and checkpointing sinks for Hugo task queues. |
|
|
Hugo.Deterministic.Redis
Redis-backed deterministic state store for Hugo workflows. |
|
|
Hugo.Deterministic.Cosmos
Azure Cosmos DB deterministic state store for Hugo workflows. |
|
|
Hugo.TaskQueues.Diagnostics
TaskQueue diagnostics helpers (meters, activity sources, sampling, adapters) for Hugo hosts. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.0.0 | 488 | 11/21/2025 |
| 2.0.0-rc.7 | 313 | 11/21/2025 |
| 2.0.0-rc.6 | 417 | 11/18/2025 |
| 2.0.0-rc.5 | 364 | 11/18/2025 |
| 2.0.0-rc.3 | 353 | 11/18/2025 |
| 1.4.11 | 258 | 11/14/2025 |
| 1.4.10 | 347 | 11/13/2025 |
| 1.4.9 | 365 | 11/12/2025 |
| 1.4.8 | 340 | 11/10/2025 |
| 1.4.7 | 276 | 11/10/2025 |
| 1.4.5 | 265 | 11/10/2025 |
| 1.4.4 | 222 | 11/9/2025 |
| 1.4.3 | 213 | 11/9/2025 |
| 1.4.2 | 261 | 10/30/2025 |
| 1.4.1 | 192 | 10/30/2025 |
| 1.4.0 | 194 | 10/27/2025 |
| 1.3.6 | 199 | 10/27/2025 |
| 1.3.5 | 178 | 10/26/2025 |
| 1.3.4 | 180 | 10/26/2025 |
| 1.3.3 | 149 | 10/25/2025 |
| 1.3.2 | 148 | 10/25/2025 |
| 1.3.0 | 117 | 10/25/2025 |
| 1.1.0 | 160 | 10/24/2025 |
| 1.0.2 | 232 | 10/23/2025 |
| 1.0.1 | 185 | 10/23/2025 |
| 1.0.0 | 248 | 10/21/2025 |
| 0.5.8 | 186 | 10/21/2025 |
| 0.5.7 | 185 | 10/21/2025 |
| 0.5.6 | 181 | 10/21/2025 |
| 0.5.5 | 177 | 10/21/2025 |
| 0.5.4 | 173 | 10/21/2025 |
| 0.5.3 | 180 | 10/21/2025 |
| 0.5.2 | 182 | 10/21/2025 |
| 0.5.0 | 179 | 10/20/2025 |
| 0.4.0 | 181 | 10/20/2025 |
| 0.3.1 | 181 | 10/20/2025 |
| 0.3.0 | 178 | 10/19/2025 |
| 0.2.0 | 185 | 10/19/2025 |
| 0.1.2 | 183 | 10/19/2025 |
| 0.1.0 | 190 | 10/19/2025 |