Last Updated: May 22, 2026
Generic functions let you stop writing one helper for []int, another for []string, and a third for []Product. This chapter walks through the small set of generic helpers most Go programs need (filter, map, reduce, min/max, contains, index, zip), looks at how to pick the right constraint for each, and ends with a rule that many developers hit by surprise: methods on generic receivers cannot introduce new type parameters.