samber/lo

Lodash-style generic utility library for Go, leveraging Go 1.18+ generics. Provides map, filter, reduce, contains, find, uniq, group by, zip, chunk, and 100+ collection utilities without code generation or reflection. Fills the gap left by Go's minimal standard library for collection manipulation.

Evaluated Mar 07, 2026 (0d ago) v1.x
Homepage ↗ Repo ↗ Developer Tools go generics functional lodash utilities map-filter-reduce collections
⚙ Agent Friendliness
69
/ 100
Can an agent use this?
🔒 Security
97
/ 100
Is it safe for agents?
⚡ Reliability
88
/ 100
Does it work consistently?

Score Breakdown

⚙ Agent Friendliness

MCP Quality
--
Documentation
90
Error Messages
82
Auth Simplicity
100
Rate Limits
100

🔒 Security

TLS Enforcement
100
Auth Strength
100
Scope Granularity
100
Dep. Hygiene
92
Secret Handling
92

Pure utility library — no network access, no security concerns.

⚡ Reliability

Uptime/SLA
92
Version Stability
88
Breaking Changes
85
Error Recovery
88
AF Security Reliability

Best When

Writing Go code that manipulates slices and maps where boilerplate loops obscure intent.

Avoid When

Go 1.17 or earlier, performance-critical code, or simple cases where a range loop is clearer.

Use Cases

  • Filter, map, and reduce Go slices without writing boilerplate loops: lo.Filter(items, func(x T, _ int) bool { return x.Active })
  • Find unique elements, group by key, or chunk slices: lo.Uniq(slice), lo.GroupBy(items, keyFn), lo.Chunk(items, 3)
  • Safely access maps without panic: lo.ValueOr(myMap, key, defaultValue) instead of map[key] with zero-value handling
  • Transform Go slices in data pipelines with type-safe generics instead of interface{} reflection approaches
  • Use lo.Must() and lo.Must2() for panic-on-error patterns in init code where error handling is verbose

Not For

  • Complex stream processing — lo is for in-memory slice/map operations, not streaming data
  • Go versions before 1.18 — lo requires generics support
  • Performance-critical hot paths — lo functions have some overhead vs hand-written loops for very large data

Interface

REST API
No
GraphQL
No
gRPC
No
MCP Server
No
SDK
Yes
Webhooks
No

Authentication

Methods: none
OAuth: No Scopes: No

Library — no auth needed.

Pricing

Model: open_source
Free tier: Yes
Requires CC: No

MIT licensed open source library.

Agent Metadata

Pagination
none
Idempotent
Full
Retry Guidance
Not documented

Known Gotchas

  • lo.Must() and lo.Must2() panic on error — use only in init code or when errors are truly impossible; use lo.TryX() or explicit error handling in production
  • lo.Map() function signature requires both value and index parameters even if index is unused: func(x T, i int) R — use _ for unused index
  • lo.Filter() preserves order and returns a new slice — does not mutate the original slice
  • Generic type inference may fail for complex types — provide explicit type parameters: lo.Map[InputType, OutputType]() if inference fails
  • lo.Ternary() is not lazy — both branches are evaluated: lo.Ternary(cond, expensiveFn(), defaultFn()) evaluates both; use if/else for lazy evaluation
  • lo.Contains() uses == comparison — works for comparable types (primitives, structs with comparable fields) but not for slices or maps

Alternatives

Full Evaluation Report

Comprehensive deep-dive: security analysis, reliability audit, agent experience review, cost modeling, competitive positioning, and improvement roadmap for samber/lo.

AI-powered analysis · PDF + markdown · Delivered within 30 minutes

$99

Package Brief

Quick verdict, integration guide, cost projections, gotchas with workarounds, and alternatives comparison.

Delivered within 10 minutes

$3

Score Monitoring

Get alerted when this package's AF, security, or reliability scores change significantly. Stay ahead of regressions.

Continuous monitoring

$3/mo

Scores are editorial opinions as of 2026-03-07.

6228
Packages Evaluated
26150
Need Evaluation
173
Need Re-evaluation
Community Powered