Skip to content

Commit 1c50d81

Browse files
pjcdawkinsclaude
andcommitted
fix(review): fix slice preallocation bug and remove redundant assignment
In answer.go, make([]string, len(...)) pre-fills with empty strings before appending, producing a slice like ["", "", "composer", "pip"]. Use capacity instead of length. In stack.go, the Symfony non-interactive case redundantly sets answers.Stack to GenericStack — it was already set before the switch. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 47f473e commit 1c50d81

2 files changed

Lines changed: 1 addition & 2 deletions

File tree

internal/question/models/answer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ func (a *Answers) ToUserInput() *platformifier.UserInput {
113113
locations[key] = value
114114
}
115115

116-
dependencyManagers := make([]string, len(a.DependencyManagers))
116+
dependencyManagers := make([]string, 0, len(a.DependencyManagers))
117117
for _, dm := range a.DependencyManagers {
118118
dependencyManagers = append(dependencyManagers, dm.String())
119119
}

internal/question/stack.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ func (q *Stack) Ask(ctx context.Context) error {
6969
return nil
7070
case platformifier.Symfony:
7171
if answers.NoInteraction {
72-
answers.Stack = models.GenericStack
7372
return nil
7473
}
7574
// Interactive: offer Symfony CLI below.

0 commit comments

Comments
 (0)