Skip to content

[plan] Eliminate redundant zero-capacity slice allocations #12178

@github-actions

Description

@github-actions

Objective

Replace 10 instances of redundant make([]T, 0) allocations with idiomatic zero-value slices.

Context

From discussion #12006: Sergo analysis found explicit zero-capacity slice allocations that are less idiomatic and create unnecessary overhead. Zero-value slices work perfectly with append and are the Go convention.

Files to Modify

  • pkg/workflow/mcp_setup_generator.go:607
  • pkg/workflow/jobs.go:48, 432
  • pkg/workflow/action_cache.go:241, 242, 279
  • pkg/workflow/compiler_safe_outputs_job.go:372
  • pkg/workflow/step_order_validation.go:42

Approach

Replace patterns like:

envVarNames := make([]string, 0)
for _, name := range vars {
    envVarNames = append(envVarNames, name)
}

With idiomatic Go:

var envVarNames []string
for _, name := range vars {
    envVarNames = append(envVarNames, name)
}

Acceptance Criteria

  • All 10 instances replaced with zero-value slice declarations
  • All existing tests pass
  • Code passes go vet and golangci-lint
  • No behavior changes (nil slices work identically with append)

AI generated by Plan Command for discussion #12006

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions