diff --git a/.golangci.yaml b/.golangci.yaml index 8b2211705bdb808e7b00736ec45aaae5971735c1..5bc1f83b89e57acda1d65416c08be1cb0c6cf7b7 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -114,6 +114,7 @@ linters: - wrapcheck - wsl_v5 - zerologlint + - prealloc disable: - depguard diff --git a/internal/completion/completion.go b/internal/completion/completion.go index 7f03746a00c4bc85295c760c7f1dd24f6b98be6f..9bab7ba7bd07121e33e0c7448e04b00fb94e12ee 100644 --- a/internal/completion/completion.go +++ b/internal/completion/completion.go @@ -32,7 +32,12 @@ func Goals(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDir return nil, cobra.ShellCompDirectiveError } - var keys []string + totalGoals := 0 + for _, a := range cfg.Areas { + totalGoals += len(a.Goals) + } + + keys := make([]string, 0, totalGoals) for _, a := range cfg.Areas { for _, g := range a.Goals {