Skip to content

Commit

Permalink
chore: nit using lo.FromPtr is safer than directly accessing the poin…
Browse files Browse the repository at this point in the history
…ter (#305)

Co-authored-by: Alex Leites <[email protected]>
  • Loading branch information
Bryce-Soghigian and tallaxes authored Apr 28, 2024
1 parent fc0b527 commit aafcbe1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/cloudprovider/cloudprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func (c *CloudProvider) Create(ctx context.Context, nodeClaim *corev1beta1.NodeC
return nil, fmt.Errorf("creating instance, %w", err)
}
instanceType, _ := lo.Find(instanceTypes, func(i *cloudprovider.InstanceType) bool {
return i.Name == string(*instance.Properties.HardwareProfile.VMSize)
return i.Name == string(lo.FromPtr(instance.Properties.HardwareProfile.VMSize))
})

return c.instanceToNodeClaim(ctx, instance, instanceType)
Expand Down Expand Up @@ -279,7 +279,7 @@ func (c *CloudProvider) resolveInstanceTypeFromInstance(ctx context.Context, ins
return nil, client.IgnoreNotFound(fmt.Errorf("resolving node template, %w", err))
}
instanceType, _ := lo.Find(instanceTypes, func(i *cloudprovider.InstanceType) bool {
return i.Name == string(*instance.Properties.HardwareProfile.VMSize)
return i.Name == string(lo.FromPtr(instance.Properties.HardwareProfile.VMSize))
})
return instanceType, nil
}
Expand Down

0 comments on commit aafcbe1

Please sign in to comment.