Skip to content

Commit 5767558

Browse files
committed
refactor: apply general code cleanups and consistency improvements
Perform general refactoring to improve consistency, readability, and maintainability across the codebase.
1 parent 4f07b36 commit 5767558

File tree

3 files changed

+6
-10
lines changed

3 files changed

+6
-10
lines changed

pkg/manager/reference.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func GenerateResourceReference(client client.Client, resource client.Object) (st
5555

5656
gvr := mapping.Resource
5757

58-
// TODO: This is a legacy thing where the OG Kubernetes service is not corrcetly
58+
// TODO: This is a legacy thing where the OG Kubernetes service is not correctly
5959
// namespaced, much like Amazon regions :D We really need to work out a migration
6060
// strategy.
6161
if gvr.Group == "unikorn-cloud.org" {
@@ -68,7 +68,7 @@ func GenerateResourceReference(client client.Client, resource client.Object) (st
6868
// GetResourceReferences returns all resource references attached to a resource.
6969
// This is used primarily to poll a resource to see if it's in use, and thus its
7070
// deletion will have consequences. It may also be used to inhibit deletion in
71-
// certain cercumstances.
71+
// certain circumstances.
7272
func GetResourceReferences(object client.Object) []string {
7373
ignored := []string{
7474
// Our finalizer to inhibit deletion until we are finished.

pkg/messaging/consumer/cascadingdelete.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ func (c *CascadingDelete) Consume(ctx context.Context, envelope *messaging.Envel
9898
}
9999

100100
if c.resourceLabel != "" {
101-
opts.LabelSelector = labels.SelectorFromSet(map[string]string{
101+
opts.LabelSelector = labels.SelectorFromSet(labels.Set{
102102
c.resourceLabel: envelope.ResourceID,
103103
})
104104
}

pkg/server/conversion/conversion.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ func OrganizationScopedResourceReadMetadata(in metav1.Object, tags unikornv1.Tag
166166
return out
167167
}
168168

169-
// ProjectScopedResourceReadMetadata extracts project scoped metdata from a resource for
169+
// ProjectScopedResourceReadMetadata extracts project scoped metadata from a resource for
170170
// GET APIs.
171171
//
172172
//nolint:errchkjson
@@ -304,12 +304,10 @@ func LogUpdate(ctx context.Context, current, required metav1.Object) error {
304304
}
305305

306306
func ConvertTag(in unikornv1.Tag) openapi.Tag {
307-
out := openapi.Tag{
307+
return openapi.Tag{
308308
Name: in.Name,
309309
Value: in.Value,
310310
}
311-
312-
return out
313311
}
314312

315313
func ConvertTags(in unikornv1.TagList) openapi.TagList {
@@ -327,12 +325,10 @@ func ConvertTags(in unikornv1.TagList) openapi.TagList {
327325
}
328326

329327
func GenerateTag(in openapi.Tag) unikornv1.Tag {
330-
out := unikornv1.Tag{
328+
return unikornv1.Tag{
331329
Name: in.Name,
332330
Value: in.Value,
333331
}
334-
335-
return out
336332
}
337333

338334
func GenerateTagList(in *openapi.TagList) unikornv1.TagList {

0 commit comments

Comments
 (0)