Use make once instead of a loop with append
This commit is contained in:
parent
ed8f4ac408
commit
d616529afc
@ -39,9 +39,9 @@ func (c *commandCategories) AddCommand(category string, command *Command) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *commandCategories) Categories() []CommandCategory {
|
func (c *commandCategories) Categories() []CommandCategory {
|
||||||
ret := []CommandCategory{}
|
ret := make([]CommandCategory, len(*c))
|
||||||
for _, cat := range *c {
|
for i, cat := range *c {
|
||||||
ret = append(ret, cat)
|
ret[i] = cat
|
||||||
}
|
}
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user