Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add prealloc to linter rules #1432

Merged
merged 1 commit into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ linters:
- nilerr
- nolintlint
- predeclared
- prealloc
- revive
- stylecheck
- unconvert
Expand Down
2 changes: 1 addition & 1 deletion cmd/gateway_dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func listWorkspaces(ctx context.Context, client *kong.Client) ([]string, error)
if err != nil {
return nil, fmt.Errorf("fetching workspaces from Kong: %w", err)
}
var res []string
res := make([]string, 0, len(workspaces))
for _, workspace := range workspaces {
res = append(res, *workspace.Name)
}
Expand Down
2 changes: 1 addition & 1 deletion kong2kic/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func createIngressPaths(
servicePort *int,
pathType k8snetv1.PathType,
) []k8snetv1.HTTPIngressPath {
var paths []k8snetv1.HTTPIngressPath
paths := make([]k8snetv1.HTTPIngressPath, 0, len(route.Paths))
for _, path := range route.Paths {
sCopy := *path
if strings.HasPrefix(sCopy, "~") {
Expand Down
2 changes: 1 addition & 1 deletion kong2tf/generate_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ func generateParents(parents map[string]string) string {
return ""
}

var result []string
result := make([]string, 0, len(parents))
for k, v := range parents {
v = strings.ReplaceAll(v, "-", "_")
// if parent ends with _id, use it as-is
Expand Down
Loading