{"id":40934886,"url":"https://github.com/tychoish/fun","last_synced_at":"2026-01-22T04:14:54.044Z","repository":{"id":65231231,"uuid":"588342837","full_name":"tychoish/fun","owner":"tychoish","description":"Go basic utility library with futures, iterators, pubsub programming, ergonomic data types, and pipeline programming. Has no third-party dependencies.","archived":false,"fork":false,"pushed_at":"2026-01-21T02:28:45.000Z","size":2722,"stargazers_count":12,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-21T09:38:36.146Z","etag":null,"topics":["concurrency","functional","futures","generic-types","go","golang","pipeline","pubsub","utility"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tychoish.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-01-12T22:27:05.000Z","updated_at":"2026-01-21T02:28:48.000Z","dependencies_parsed_at":"2023-02-17T14:10:16.235Z","dependency_job_id":"ed71a8f8-1032-4961-80ce-f65dc82bc381","html_url":"https://github.com/tychoish/fun","commit_stats":{"total_commits":550,"total_committers":1,"mean_commits":550.0,"dds":0.0,"last_synced_commit":"740c84b9e68541f3fb896acadc40db8f06cbf6c7"},"previous_names":[],"tags_count":51,"template":false,"template_full_name":null,"purl":"pkg:github/tychoish/fun","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tychoish%2Ffun","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tychoish%2Ffun/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tychoish%2Ffun/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tychoish%2Ffun/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tychoish","download_url":"https://codeload.github.com/tychoish/fun/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tychoish%2Ffun/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28653950,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-22T01:17:37.254Z","status":"online","status_checked_at":"2026-01-22T02:00:07.137Z","response_time":144,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["concurrency","functional","futures","generic-types","go","golang","pipeline","pubsub","utility"],"created_at":"2026-01-22T04:14:53.341Z","updated_at":"2026-01-22T04:14:54.030Z","avatar_url":"https://github.com/tychoish.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fun -- Core Library for Go Programming\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/tychoish/fun.svg)](https://pkg.go.dev/github.com/tychoish/fun)\n\n`fun` is a simple, well-tested, zero-dependency \"Core Library\" for\nGo. Think of it as a collection of the best parts of the `utils`\npackage or `shared` or `common` packages in any given Go application,\nbut with solid design, highly ergonomic interfaces, and thorough\ntesting.\n\n`fun` aims to be easy to adopt: the interfaces (and implementations!)\nare simple and (hopefully!) easy to use. There are no external\ndependencies and _all_ of the code is well-tested. You can (and\nshould!) always adopt the tools that make the most sense to use for\nyour project.\n\n## Highlights\n\n- Every **iterator** tool you always wish you had in the `irt` (ha!)\n  package. Easily create, manipulate, and transform iterators, and\n  avoid writing (and rewriting,) basic logic again and again.\n\n- **Error tools**. `erc.Collector` is an error aggregator safe for\n  concurrent access, with methods to collect errors conditionally (for\n  validation), and annotating errors. The `ers` collection has a\n  string-derived error type `ers.Error` so that you can have `const`\n  errors.\n\n- A set of **worker pools** helpers and tools in the `wpa` package for\n  both ephemeral workloads as well as long-running\n  pipelines. Particularly powerful in combination with the data types,\n  iterator tools, and pubsub tooling.\n\n- Powerful synchronization and **atomic** primitives, updated for the\n  era of generics in `adt`:\n\n  - `adt.Map[K,V]` means now you can use `sync.Map` without\n    (terrifying) type casts everywhere.\n\n  - `adt.Pool[T]` provides a type-safe `sync.Pool` with cleanup and\n    constructor hooks.\n\n  - `adt.Atomic[T]` is an atomic value container, that you can use to\n    avoid littering your code with mutexes. (n.b. you _can_ store\n    mutable atomic values in `adt.Atomic[T]` which are (of course) not\n    safe for concurrent use, which is a bit of a gotcha, but for this\n    `adt.Locked[T]` steps in to handle the mutex for you.\n\n  - `adt.Once[T]` means you can get `sync.OnceFunc`, and friends, but\n    as a type that you can add as a field to your on types for mutexes\n    that you don't have to manage yourself.\n\n  - within `adt`, `shard.Map[K,V]` provides a write-optimized, fully\n    versioned map implementation that divides the keyspace among a\n    number of constituent maps (shards) to reduce mutex contention for\n    certain workloads.\n\n- Delightful **data types** you always wish you had, in the `dt`\n  package:\n\n  - a ring buffer (`dt.Ring[T]`)\n  - single and doubly linked lists (`dt.Stack[T]` and `dt.List[T]`)\n  - sets (`dt.Set[K]` and `dt.OrderedSet[T]`)\n  - an ordered map `dt.OrderedMap[K,V]` (also thread safe, and\n    accessible via `adt`.)\n  - histograms (in `dt/hdrhist`)\n  - wrappers of standard library (**stw**)things (maps, slices,\n    pointers,) for ergonomic takes on Go constructs.\n  - an \"optional\" wrapper (`dt.Optional[T]`) so you can avoid\n    overloading pointer values in your type definitions.\n\n- A collection of **function object tools**, wrappers and tools for\n  common function type in `fn` (without contexts) and `fnx` (with\n  contexts).\n\n- Higher order **pubsub** tools, notably threadsafe queue and deque\n  implementations--`pubsub.Queue[T]` and `pubsub.Deque[T]` which avoid\n  channels entirely, and have support for unlimited, fixed-buffered,\n  and burstable limits. Also a one-to-many or a many-to-many message\n  broker, so you can have a \"broadcast channel.\"\n\n- **Service orchestration**. `srv.Service` handles the lifecycle of\n  \"background\" processes inside of an application. You can now start\n  services like HTTP servers, background monitoring and workloads, and\n  sub-processes, and ensure that they exit cleanly (at the right\n  time!) and that their errors propagate clearly back to the \"main\"\n  thread.\n\n- Lightweight **test infrastructure**: `assert` and `check`\n  (testify-style assertions, but with generics,) testing tools and\n  helpers in `testt` (testy!), and a fluent-style interface with\n  `ensure`.\n\n## Version History\n\nThere are no plans for a 1.0 release, though major backward-breaking\nchanges increment the second (major) release value, and limited\nmaintenance releases are possible/considered to maintain\ncompatibility.\n\n- `v0.14.0`: go1.24 and greater. Re-focus API; new `irt` and `wpa`\n  packages. Move all code out of the root package. (current)\n- `v0.13.0`: go1.24 and greater. Reorganization of function API, and a\n  bridge to the next major release. (experimental)\n- `v0.12.0`: go1.24 and greater. Major API impacting\n  release. (maintained)\n- `v0.11.0`: go1.23 and greater.\n- `v0.10.0`: go1.20 and greater.\n- `v0.9.0`: go1.19 and greater.\n\nThere may be small changes to exported APIs within a release series,\nalthough, major API changes will increment the major release value.\n\n## Contribution\n\nContributions welcome, the general goals of the project:\n\n- superior API ergonomics.\n- great high-level abstractions.\n- obvious and clear implementations.\n- no external dependencies.\n\nPlease feel free to open issues or file pull requests.\n\nHave fun!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftychoish%2Ffun","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftychoish%2Ffun","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftychoish%2Ffun/lists"}