go-modernize
Installation
SKILL.md
Go Modernize
Go evolves. Code written for Go 1.16 should not look the same as code targeting
Go 1.22+. Modernize incrementally — update go.mod, then adopt new patterns.
1. Generics (Go 1.18+)
Replace interface{} / any with type parameters where appropriate:
// ❌ Before — loses type safety
func Contains(slice []interface{}, target interface{}) bool {
for _, v := range slice {
if v == target {
return true
}
}
return false
}