What problem does it solve?
It removes repetitive boilerplate for transforming and grouping data in Go slices and maps, so developers can express intent directly instead of hand-writing error-prone loops.
Core Features & Use Cases
- Type-safe functional transforms: map/filter/reduce, grouping, chunking, flattening, and deduplication for slices and maps.
- Error-aware variants: functions with Err suffixes (e.g., MapErr, FilterErr, ReduceErr) that stop early and return errors.
- Performance options: choose immutable core (lo) by default, switch to concurrent CPU-bound transforms (lop) when appropriate, use in-place mutations (lom) only on validated hot paths, and use lazy iterators (loi) for large multi-step pipelines on Go 1.23+.
Use Case: Transform a list of uploaded file metadata into per-type groups (video/audio/images/docs) by filtering on type, mapping to a normalized representation, then grouping by category for downstream indexing or media processing.
Quick Start
Use the golang-samber-lo skill to refactor your slice transformation into lo.Map/lo.Filter/lo.GroupBy (or loi for lazy pipelines) to implement a clear, type-safe collection workflow.