Use make once instead of a loop with append

This commit is contained in:
Dan Buch 2016-05-27 14:38:51 -04:00
parent ed8f4ac408
commit d616529afc
No known key found for this signature in database
GPG Key ID: FAEF12936DD3E3EC

View File

@ -39,9 +39,9 @@ func (c *commandCategories) AddCommand(category string, command *Command) {
}
func (c *commandCategories) Categories() []CommandCategory {
ret := []CommandCategory{}
for _, cat := range *c {
ret = append(ret, cat)
ret := make([]CommandCategory, len(*c))
for i, cat := range *c {
ret[i] = cat
}
return ret
}