go-generics
Installation
SKILL.md
Go Generics and Type Parameters
Compatibility: Generics require Go 1.18+.
Resource Routing
references/CONSTRAINTS.md- Read when composing constraints, using type sets, or choosing between generics and interfaces.
When to Use Generics
Start with concrete types. Generalize only when a second type appears.
Prefer Generics When
- Multiple types share identical logic (sorting, filtering, map/reduce)
- You would otherwise rely on
anyand excessive type switching - You are building a reusable data structure (concurrent-safe set, ordered map)