Skip to content

Commit 78a2633

Browse files
committed
refactor(hrq): Update truncate function to use uint.
1 parent e3589c1 commit 78a2633

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

internal/hrq/utils/scopedhrq.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ func ScopedRQName(hrqNamespace string, hrqName string) (string, error) {
7474

7575
namespaceAndName := truncate(
7676
fmt.Sprintf("%s-%s", hrqNamespace, hrqName),
77-
validation.DNS1123SubdomainMaxLength-len(hashStr)-len(api.ResourceQuotaSingletonName)-2,
77+
uint(validation.DNS1123SubdomainMaxLength-len(hashStr)-len(api.ResourceQuotaSingletonName)-2),
7878
)
7979

8080
return fmt.Sprintf("%s-%s-%s", api.ResourceQuotaSingletonName, namespaceAndName, hashStr), nil
@@ -94,8 +94,8 @@ func SetLabelsAnnotationsForScopedRQ(rq *v1.ResourceQuota, hrqNamespace string,
9494
metadata.SetLabel(rq, hrqNameLabel, hrqName)
9595
}
9696

97-
func truncate(s string, n int) string {
98-
if len(s) <= n {
97+
func truncate(s string, n uint) string {
98+
if uint(len(s)) <= n {
9999
return s
100100
}
101101
return s[:n]

0 commit comments

Comments
 (0)