packer: Cleaner way to build up a list of names

This commit is contained in:
Mitchell Hashimoto 2013-05-08 17:11:02 -07:00
parent 198f984b92
commit 8a78de02c7
1 changed files with 2 additions and 4 deletions

View File

@ -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