generics
3 articles
-
Represent and transform data safely
Sum Values in a Go Slice with a Loop or `slices.Reduce`
Use a range loop for a straightforward `[]int` total, or a third-party reducer when the callback makes a more varied calculation easier to express.
-
Represent and transform data safely
How to Merge Two Maps in Go
Merge Go maps with a loop or maps.Copy, choose whether to mutate an input, and understand when generics or mergo better fit the job.
-
Represent and transform data safely
Go Generics: How to Write Type Parameters, Constraints, and Generic Interfaces
Learn how Go type parameters are instantiated, how to choose constraints, and how to build generic functions, types, and interfaces.



