fix new linter warnings from prealloc linter

This commit is contained in:
Ryan Richard
2026-02-13 15:19:15 -08:00
parent 745c93af51
commit e5366d782d
20 changed files with 50 additions and 48 deletions
@@ -1,4 +1,4 @@
// Copyright 2023-2024 the Pinniped contributors. All Rights Reserved.
// Copyright 2023-2026 the Pinniped contributors. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
// Package idtransform defines upstream-to-downstream identity transformations which could be
@@ -90,7 +90,7 @@ func (p *TransformationPipeline) Evaluate(ctx context.Context, username string,
}
func (p *TransformationPipeline) Source() []any {
result := []any{}
result := make([]any, 0, len(p.transforms))
for _, transform := range p.transforms {
result = append(result, transform.Source())
}
@@ -1,4 +1,4 @@
// Copyright 2023-2024 the Pinniped contributors. All Rights Reserved.
// Copyright 2023-2026 the Pinniped contributors. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
package idtransform
@@ -44,7 +44,7 @@ func (a fakeNilGroupTransformer) Source() any {
type fakeAppendStringTransformer struct{}
func (a fakeAppendStringTransformer) Evaluate(_ctx context.Context, username string, groups []string) (*TransformationResult, error) {
newGroups := []string{}
newGroups := make([]string, 0, len(groups))
for _, group := range groups {
newGroups = append(newGroups, group+":transformed")
}
@@ -78,7 +78,7 @@ func (a fakeDeleteUsernameAndGroupsTransformer) Source() any {
type fakeAuthenticationDisallowedTransformer struct{}
func (a fakeAuthenticationDisallowedTransformer) Evaluate(_ctx context.Context, username string, groups []string) (*TransformationResult, error) {
newGroups := []string{}
newGroups := make([]string, 0, len(groups))
for _, group := range groups {
newGroups = append(newGroups, group+":disallowed")
}