Skip to content

BUG: String concatenation in loop in i18n validator report #963

@andrinoff

Description

@andrinoff

Describe the bug

In i18n/validator.go:127-139, report string is built with repeated +=:

report += fmt.Sprintf("  [%s] %s: %s\n", err.Language, err.Key, err.Message)
report += fmt.Sprintf("  [%s] %d missing keys:\n", lang, len(keys))

For large validation reports with many languages and keys, this creates O(n²) allocations.

To reproduce

Run i18n validation with many languages and missing keys.

Expected behavior

Use strings.Builder instead of string concatenation.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinggood first issueGood for newcomersperformancePerformance improvement

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions