Skip to content

Commit b304ed2

Browse files
authored
Merge pull request #5238 from nojnhuh/no-prealloc-deux
skip prealloc linter
2 parents 6b0862b + f57ca37 commit b304ed2

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

.golangci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ linters:
3939
- noctx # http requests without context.Context
4040
- nolintlint # badly formatted nolint directives
4141
- nosprintfhostport # using sprintf to construct host:port in a URL
42-
- prealloc # suggest preallocating slices
42+
# We don't want to use this one: https://github.com/kubernetes-sigs/cluster-api-provider-azure/pull/4703
43+
# - prealloc # suggest preallocating slices
4344
- predeclared # shadowing predeclared identifiers
4445
- revive # better version of golint
4546
- staticcheck # some of staticcheck's rules

azure/services/subnets/spec.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,7 @@ func (s *SubnetSpec) Parameters(_ context.Context, existing *asonetworkv1.Virtua
9898
}
9999
}
100100

101-
// TODO (nojnhuh) : do we want to initialize serviceEndpoints with an empty slice instead?
102-
var serviceEndpoints []asonetworkv1.ServiceEndpointPropertiesFormat //nolint:prealloc // leaving it as is for now
101+
var serviceEndpoints []asonetworkv1.ServiceEndpointPropertiesFormat
103102
for _, se := range s.ServiceEndpoints {
104103
serviceEndpoints = append(serviceEndpoints, asonetworkv1.ServiceEndpointPropertiesFormat{Service: ptr.To(se.Service), Locations: se.Locations})
105104
}

controllers/resource_reconciler.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,7 @@ func (r *ResourceReconciler) Reconcile(ctx context.Context) error {
6363
defer done()
6464
log.V(4).Info("reconciling resources")
6565

66-
// TODO (nojnhuh) : is there a functional diff between
67-
// var newResourceStatuses []infrav1alpha.ResourceStatus and newResourceStatuses := make([]infrav1alpha.ResourceStatus,0)
68-
// in the scenario below?
69-
var newResourceStatuses []infrav1alpha.ResourceStatus //nolint:prealloc // leaving it as is for now
66+
var newResourceStatuses []infrav1alpha.ResourceStatus
7067

7168
for _, spec := range r.resources {
7269
gvk := spec.GroupVersionKind()

0 commit comments

Comments
 (0)