Allocate memory for output slice in pkgPrompt() using make()
This commit is contained in:
parent
095630ab91
commit
f00fc25734
6
repo.go
6
repo.go
|
@ -160,9 +160,9 @@ func pkgPrompt(options []string) ([]string, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
var out []string
|
||||
for _, i := range choices {
|
||||
out = append(out, options[i])
|
||||
out := make([]string, len(choices))
|
||||
for i, choiceIndex := range choices {
|
||||
out[i] = options[choiceIndex]
|
||||
}
|
||||
|
||||
return out, nil
|
||||
|
|
Loading…
Reference in New Issue