Skip to content

Commit

Permalink
ci: add prealloc to linter rules (#1432)
Browse files Browse the repository at this point in the history
  • Loading branch information
pmalek authored Nov 7, 2024
1 parent 3305886 commit f8d3d2a
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
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

0 comments on commit f8d3d2a

Please sign in to comment.