.golangci.yaml 🔗
@@ -114,6 +114,7 @@ linters:
- wrapcheck
- wsl_v5
- zerologlint
+ - prealloc
disable:
- depguard
Amolith created
- Enable prealloc linter in golangci config
- Preallocate slice capacity in Goals completion function
Assisted-by: Claude Opus 4.5 via Amp
.golangci.yaml | 1 +
internal/completion/completion.go | 7 ++++++-
2 files changed, 7 insertions(+), 1 deletion(-)
@@ -114,6 +114,7 @@ linters:
- wrapcheck
- wsl_v5
- zerologlint
+ - prealloc
disable:
- depguard
@@ -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 {