diff --git a/types/schemas.go b/types/schemas.go index c2e153c5..54d6e45d 100644 --- a/types/schemas.go +++ b/types/schemas.go @@ -141,12 +141,11 @@ func (s *Schemas) doAddSchema(schema Schema, replace bool) *Schemas { schemas[schema.ID] = &schema if replace { - for i, candidate := range s.schemas { - if candidate.ID == schema.ID { - s.schemas[i] = &schema - break - } - } + i := slices.IndexFunc(s.schemas, func(candidate *Schema) bool { + return candidate.ID == schema.ID + }) + + s.schemas[i] = &schema } else { s.schemas = append(s.schemas, &schema) }