golang-samber-lo

Refactor Go code to use samber/lo functional utilities for collections.

Updated May 28, 2026
One-click install
npx skills add https://github.com/vanstinator/semantic-search --skill golang-samber-lo-vanstinator
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golang-samber-lo
Source: https://github.com/vanstinator/semantic-search/tree/main/.agents/skills/golang-samber-lo
Command: npx skills add https://github.com/vanstinator/semantic-search --skill golang-samber-lo-vanstinator

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps you eliminate repetitive for-loops in Go by providing Lodash-inspired, type-safe functional utilities that make collection transformations more readable and safer.

Core Features & Use Cases

  • Declarative slice/map transforms: use immutable helpers like Map, Filter, Reduce, and GroupBy to express business logic without manual iteration.
  • Error-aware and composable patterns: apply MapErr and FilterMap to handle failures predictably (stop-on-first error vs skip-and-continue).
  • Performance-informed variants: switch to lop for CPU-bound parallelism, lom for in-place mutation on hot paths, and loi for lazy evaluation when chaining many transforms.

Quick Start

Use the golang-samber-lo skill to refactor your Go function that currently uses nested loops into a clear pipeline using lo.Map, lo.Filter, and lo.GroupBy, and ask it to choose the right variant (lo vs lop vs lom vs loi) based on dataset size and whether you want immutability or in-place mutation.

Frequently Asked Questions about golang-samber-lo

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

FAQPage Schema
How do I replace repetitive for-loops in Go with functional programming transforms?

To replace repetitive for-loops in Go with functional programming transforms, use Lodash-inspired utilities like Map, Filter, and Reduce to express business logic declaratively. This approach provides type-safe generics and immutable-by-default semantics for cleaner collection transformations.

What's the best way to handle errors during Go slice or map transformations?

The best way to handle errors during Go slice or map transformations is using error-aware patterns like MapErr and FilterMap. MapErr stops on the first error for predictable failures, while FilterMap skips and continues, allowing composable and safe data processing workflows.

When should I use parallel concurrency variants instead of standard immutable transforms in Go?

Use parallel concurrency variants instead of standard immutable transforms in Go when dealing with CPU-bound workloads on large datasets. Performance-informed variants like lop provide CPU-bound parallelism, while loi offers lazy evaluation for chaining many transforms efficiently.

Can I use in-place mutation for Go collection processing on performance-critical hot paths?

Yes, you can use in-place mutation for Go collection processing on performance-critical hot paths by selecting the lom variant. This optimizes memory usage by mutating data directly instead of creating new immutable copies during slice and map operations.

Does Go functional programming with generics support GroupBy workflows?

Yes, Go functional programming with generics supports GroupBy workflows. You can use declarative helpers to group collection elements by key, allowing you to express complex data partitioning logic clearly without writing manual iteration loops.