Prompt Refactor

Go Generics Patterns

Apply Go generics to reduce duplication with type-safe abstractions.

go
Insert label Generics
Prompt

Refactor this Go code to use generics where it reduces duplication. Use type parameters for collection utilities, result types, or repository patterns. Keep constraints tight (use specific interfaces, not any), and only introduce generics where they genuinely eliminate repeated code.

Add this to your Facet Inserts in Crystl for one-click access.

Get Crystl