golang-samber-lo

Implements functional collection transforms in Go using the samber/lo generics library.

1|Updated Jun 2, 2026
One-click install
npx skills add https://github.com/VerifiedOrganic/onboard --skill golang-samber-lo-verifiedorganic
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: golang-samber-lo
Source: https://github.com/VerifiedOrganic/onboard/tree/main/.agents/skills/golang-samber-lo
Command: npx skills add https://github.com/VerifiedOrganic/onboard --skill golang-samber-lo-verifiedorganic

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires github.com/samber/lo, and includes references (resource) components.

What problem does it solve? Go's standard library only covers a handful of slice and map helpers, forcing developers to write repetitive manual loops for common operations like Map, Filter, Reduce, and GroupBy. This Skill guides AI agents to write type-safe, declarative Go code using samber/lo's 500+ generic functions while avoiding common misuse patterns. ## Core Features & Use Cases - Package Selection Guidance: Choose correctly between the immutable core (lo), parallel transforms (lop), in-place mutations (lom), lazy iterators (loi), and experimental SIMD based on profiling evidence and Go version constraints. - Complete API Reference: Access a catalog of 300+ functions covering slices, maps, strings, math, tuples, channels, and concurrency helpers like Debounce, Throttle, and retry with backoff. - Mistake Prevention: Avoid traps like using lop for I/O-bound work, assuming lo.Filter mutates input, or calling lo.Must inside HTTP handlers. - Use Case: When refactoring a service that processes large record sets, the Skill recommends a lazy loi pipeline (Filter → Map → Take) to eliminate intermediate slice allocations, or redirects streaming use cases to samber/ro. ## Quick Start Ask the agent to refactor a manual Go loop over a slice into samber/lo functions, for example converting a filter-and-extract loop into lo.Filter and lo.Map calls.

Frequently Asked Questions about golang-samber-lo

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I use samber/lo to map and filter slices in Go?▼

Use lo.Map to transform each element and lo.Filter to keep elements matching a predicate; both take the slice plus a callback receiving the item and index. They return new slices, so chain them directly, for example lo.Map(lo.Filter(users, isActive), getName).

What is the difference between lo, lop, lom, and loi packages?▼

lo is the immutable core for general transforms, lop runs CPU-bound transforms in parallel goroutines, lom mutates slices in place to avoid allocations, and loi provides lazy iterators requiring Go 1.23+. Start with lo and switch only after profiling confirms a bottleneck.

Should I use lop.Map for concurrent HTTP requests in Go?▼

No, lop is designed for CPU-bound parallelism, not I/O-bound work like HTTP calls. For concurrent network requests use errgroup, which provides context cancellation and proper error propagation that lop lacks.

Does samber/lo work with Go 1.20 or older versions?▼

The core lo, lop, and lom packages require Go 1.18 or later, so they work with Go 1.20. However, the lazy iterator package lo/it requires Go 1.23+ because it uses range-over-func, and the experimental SIMD package needs Go 1.25+ on amd64.

Why does lo.Filter not modify my original slice?▼

lo is immutable by default, so lo.Filter returns a new slice and leaves the input untouched; discarding the return value is a common bug. If you explicitly need in-place mutation, use lom.Filter from the lo/mutable package instead.

When should I prefer Go stdlib over samber/lo functions?▼

Prefer stdlib slices.Contains and slices.Sort (Go 1.21+) and slices.Collect(maps.Keys(m)) (Go 1.23+) when they cover the operation, since they carry no dependency. Use lo for transforms the stdlib lacks, such as Map, Filter, Reduce, GroupBy, Chunk, and Flatten.