A Lodash-style Go utility library based on Go 1.18+ generics for working with slices, maps, channels, and functions.
Lo is a comprehensive utility library for Go that provides dozens of synchronous helper functions for manipulating slices, maps, strings, channels, and functions. Inspired by Lodash, it leverages Go 1.18+ generics to offer type-safe operations that simplify common coding tasks and improve code readability. It focuses on synchronous helpers for finite sequences while maintaining zero dependencies outside the Go standard library.
Go developers working with Go 1.18+ who need expressive, type-safe utilities for data manipulation, particularly those familiar with Lodash-style functional programming patterns. It's especially useful for developers handling collections, concurrency patterns, and string transformations in their applications.
Developers choose Lo for its extensive collection of type-safe, generic utilities that bring Lodash-like expressiveness to Go, combined with zero external dependencies. Its unique selling point is providing dozens of synchronous helpers across multiple data types (slices, maps, strings, channels) with full generics support, plus specialized packages for parallel processing, mutable operations, and iteration.
💥 A Lodash-style Go library based on Go 1.18+ Generics (map, filter, contains, find...)
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Leverages Go 1.18+ generics for compile-time type checking across all operations, ensuring safety and reducing runtime errors, as evidenced by functions like Map and Filter that work with any type.
Integrates error propagation directly into collection functions like MapErr and FilterErr, allowing robust operations without breaking the functional programming flow, which is detailed in the README examples.
Includes helpers such as ChannelDispatcher, FanIn, and parallel processing variants in the lo/parallel package, facilitating goroutine-safe operations and efficient data processing for concurrent scenarios.
Maintains no dependencies outside the Go standard library, simplifying integration and reducing dependency management overhead, as stated in the installation and philosophy sections.
The README admits that 5-10 helpers overlap with Go's slices and maps packages, which can lead to confusion or unnecessary code duplication for developers already using standard library functions.
Functions in lo/mutable, like Shuffle and Reverse, modify slices in place, increasing the risk of unintended side effects and bugs if not handled carefully, as highlighted in the mutable examples.
With over a hundred functions across slices, maps, strings, and more, the extensive API can be overwhelming for newcomers and may introduce complexity in projects that only need a subset of features.
lo is an open-source alternative to the following products: