Skip to content

Commit

Permalink
examples/hyprctl: avoid unnecessary append in usage
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagokokada committed Aug 17, 2024
1 parent 13a7d68 commit e4de0b9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions examples/hyprctl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,11 @@ func usage(m map[string]func(args []string)) {
fmt.Fprintf(out, "Available subcommands:\n")

// Sort keys before printing, since Go randomises order
subcommands := make([]string, 0, len(m))
subcommands := make([]string, len(m))
i := 0
for s := range m {
subcommands = append(subcommands, s)
subcommands[i] = s
i++
}
sort.Strings(subcommands)
for _, s := range subcommands {
Expand Down

0 comments on commit e4de0b9

Please sign in to comment.