Skip to content

[Code Quality] Migrate string concatenation (+=) in loops to strings.Builder in pkg/workflow and pkg/cli #48321

Description

@github-actions

Description

The LintMonster daily scan (2026-07-27) identified 41 findings of repeated string concatenation using += inside loops:

  • pkg/workflow: 18 occurrences
  • pkg/cli: 23 occurrences

This pattern creates unnecessary memory allocations on each iteration. Migrating to strings.Builder improves performance and follows Go best practices.

Suggested Changes

  • Replace var s string; for ... { s += chunk } patterns with var sb strings.Builder; for ... { sb.WriteString(chunk) }; return sb.String()
  • Validate each fix with make golint-custom
  • Keep changes scoped to the string-concatenation pattern only

Files Affected

  • Multiple files in pkg/workflow/ (18 occurrences)
  • Multiple files in pkg/cli/ (23 occurrences)

Run make golint-custom to get the exact list of affected files and line numbers.

Success Criteria

  • Zero string concatenation with += inside a loop diagnostics in make golint-custom output
  • All existing tests pass
  • No functional changes to output

Source

Extracted from LintMonster daily scan #48252

Priority

Medium — 41 clear findings ready to address

🔍 Task mining by Discussion Task Miner - Code Quality Improvement Agent · sonnet46 · 53.1 AIC · ⌖ 8.15 AIC · ⊞ 7.2K ·

  • expires on Jul 28, 2026, 12:03 AM UTC-08:00

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions