lo

A Lodash-style Go library built on Go 1.18+ generics for working with slices, maps, channels, and functions.

Library
Go
vv1.53.0
21,416stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
88/100Excellent
Development Activity92
Maintenance100
Community64
Maturity56
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
79/100Good
Architecture78
Code Quality92
Innovation60
Learning Curve85

samber/lo brings Lodash-style ergonomics to Go through Go 1.18+ generics, filling a gap the standard library’s slices and maps packages leave open. It packages dozens of type-safe helpers for filtering, mapping, grouping, and transforming slices, maps, and channels, plus utilities for tuples, retries, debouncing, and safe error handling, all without pulling in any dependency outside the Go standard library.

Beyond the core package, lo ships companion subpackages (parallel, mutable, it) for parallel execution, in-place slice mutation, and Go 1.23+ iterator-based helpers, letting teams opt into more advanced patterns without bloating the base API.

What You Get

  • Dozens of generic slice functions (Filter, Map, Reduce, GroupBy, Chunk, Uniq, Flatten, and more) that work on any named slice type.
  • Map utilities (KeyBy, PickBy, MapValues, Entries) and Tuple2-Tuple9 types with Unpack() for structured returns.
  • Error-safe transform variants (FilterErr, MapErr) and a Try/TryOr/Attempt/Must family for controlled error handling.
  • Retry-with-backoff, Debounce, and Async helpers for common resilience and concurrency patterns.
  • Companion subpackages (parallel, mutable, it) for parallel execution, in-place mutation, and Go 1.23+ range-over-func iterators.

Common Use Cases

  • Replacing manual for-loops with declarative slice and map transformations.
  • Propagating the first error from a batch transform instead of silently continuing past it.
  • Wrapping flaky network or database calls with retry-and-backoff logic.
  • Choosing parallel, in-place, or iterator-based variants of the same operation to tune performance.

Under The Hood

Architecture lo is a flat, single-package library organized by domain-of-function across files (slice.go, map.go, find.go, tuples.go, errors.go, retry.go, concurrency.go, channel.go, condition.go, math.go, string.go, time.go, type_manipulation.go) rather than by internal layering — each file groups related generic functions that operate directly on caller-supplied slices/maps with no shared internal state, so every exported function is a pure, stateless transform taking a collection and a callback and returning a new collection. Supplementary concerns are split into separate importable subpackages under the same module (parallel/ for goroutine-per-element parallel Map, mutable/ for in-place slice ops that mutate the input instead of allocating, it/ for Go 1.23+ range-over-func iterator variants, exp/simd/ gated behind Go 1.26 SIMD build tags), which keeps the core package’s API surface small while letting callers opt into different performance and mutation tradeoffs; internal/ hosts constraints and small helpers not part of the public contract. If a core convention like the Tuple2..Tuple9 types or the predicate signature func(item T, index int) bool changed, essentially every file in the package would need updating since it’s applied uniformly.

Tech Stack Pure Go 1.18+ using generics, with zero runtime dependencies. The only dependencies declared in go.mod are dev/test-only — testify for assertions and go.uber.org/goleak for goroutine-leak detection, with golang.org/x/text and go-funk excluded from releases per the module’s own comment. Build/test runs through a Makefile wrapping go build and go test -race; CI (.github/workflows/test.yml) runs the full Go version matrix from 1.18 through “stable” plus a 1.26 SIMD experiment, and .golangci.yml enables an extensive linter set (govet, staticcheck, errcheck, gocritic, gocyclo, revive, exhaustive, forcetypeassert, nestif, and more). A separate Docusaurus/TypeScript documentation site lives under docs/, independent of the Go library itself.

Code Quality Every source file has a matching *_test.go with table/subtest structure using testify’s assert and t.Parallel() throughout, plus _example_test.go files providing runnable godoc examples referenced by “Play:” links in doc comments — extensive test coverage rather than a token suite. Error handling is explicit and typed: functions that can fail return (T, error) instead of panicking (MapErr, FilterErr, the Try/TryOr/Attempt family), reserving panics for the opt-in Must variants. Naming is consistent, idiomatic Go, and types.go/constraints.go centralize generic constraints reused across files. CI enforces the version matrix plus a strict golangci-lint ruleset, and goleak checks catch leaked goroutines in concurrency-related tests.

What Makes It Unique lo’s core value is bringing Lodash-equivalent ergonomics to Go through generics in a way the standard library’s slices/maps packages don’t fully cover — grouping, chunking, sliding windows, partitioning, tuple types with Unpack(), typed Try/Must error helpers, and a debounce implementation aren’t in stdlib. It’s a well-executed adaptation of an established pattern rather than a novel abstraction: every function is documented with a Go Playground link for low-friction trial, and the split subpackages (parallel/mutable/it) let adopters choose eager-parallel, in-place, or lazy-iterator variants of the same operations without forking the API — a thoughtful but incremental developer-experience choice rather than groundbreaking innovation.

Used by 11 apps in this directory

Go
90%
Apache 2.0

CasaOS

Hosting Control Panel · File Storage

37,163

Your simple, elegant personal cloud OS for home data and apps

View details
51
Repo Health
71
Technical
65
Dependency
Built with
Go90%
Updated 1 years ago
Go
75%
MIT

Digger

Devops · Automation · Developer Tools

5,033

Run Terraform and OpenTofu natively inside your existing CI pipeline — no separate runners, no third-party secrets, no extra compute costs.

View details
71
Repo Health
73
Technical
67
Dependency
Built with
Go75%
TypeScript15%
Updated 2 weeks ago
Go
73%
Other

Flipt

Devops · Developer Tools

4,884

Git-native feature flag platform that stores, versions, and deploys feature toggles directly in your own Git repositories with no external database required.

View details
89
Repo Health
83
Technical
70
Dependency
Built with
Go73%
TypeScript26%
Updated yesterday
Go
83%
Apache 2.0

frp

Networking

109,098

A fast reverse proxy that exposes local servers behind NAT or firewalls to the public internet with multi-protocol support.

View details
95
Repo Health
82
Technical
71
Dependency
Built with
Go83%
Vue12%
Updated yesterday
TypeScript
71%
Other

highlight.io

Developer Tools · Analytics · Monitoring

9,373

Open-source full-stack monitoring that unifies session replay, error tracking, logging, and distributed tracing so you can stop context-switching between tools.

View details
70
Repo Health
78
Technical
65
Dependency
Built with
TypeScript71%
Go16%
Updated 1 weeks ago
Go
78%
Apache 2.0

OpenMeter

Invoicing Finance · Developer Tools

2,236

Open-source metering and billing engine for AI, agentic, and DevTool monetization — ingest usage events in real time and turn them into accurate invoices automatically.

View details
86
Repo Health
81
Technical
66
Dependency
Built with
Go78%
TypeScript17%
Updated 2 days ago
Go
91%
Apache 2.0

Ory Kratos

Authentication

13,853

API-first identity and user management that handles login, registration, MFA, and recovery so your application never has to.

View details
84
Repo Health
78
Technical
67
Dependency
Built with
Go91%
Updated 1 months ago
Go
90%
AGPL 3.0

Pyroscope

Monitoring · Devops · Developer Tools

11,643

An open-source, horizontally scalable continuous profiling platform that pinpoints CPU, memory, and I/O bottlenecks down to the exact line of code, built by Grafana Labs alongside Loki, Tempo, and Mimir.

View details
91
Repo Health
89
Technical
66
Dependency
Built with
Go90%
Updated 2 days ago
TypeScript
52%
Other

SigNoz

Monitoring · Analytics

31,972

Self-host your entire observability stack — logs, metrics, traces, and LLM monitoring — in one OpenTelemetry-native platform, without the Datadog bill.

View details
92
Repo Health
83
Technical
69
Dependency
Built with
TypeScript52%
Go37%
Updated today

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search