diff --git a/packer/template.go b/packer/template.go index a0fb2b4c8..23daecfc7 100644 --- a/packer/template.go +++ b/packer/template.go @@ -81,11 +81,9 @@ func ParseTemplate(data []byte) (t *Template, err error) { // BuildNames returns a slice of the available names of builds that // this template represents. func (t *Template) BuildNames() []string { - names := make([]string, len(t.Builders)) - i := 0 + names := make([]string, 0, len(t.Builders)) for name, _ := range t.Builders { - names[i] = name - i++ + names = append(names, name) } return names