From 637235f0a6af483ddf45e16c5ad800fee5bb946b Mon Sep 17 00:00:00 2001 From: Julien Pivotto Date: Thu, 20 Apr 2023 16:19:50 +0200 Subject: [PATCH] Revert type casting removal This reverts the removal of type casting due to an error in the dragonfly integration. The change in the type casting introduced by the commit causes a type mismatch, resulting in the following errors: util/runtime/limits_default.go:42:57: cannot use rlimit.Cur (variable of type int64) as type uint64 in argument to limitToString util/runtime/limits_default.go:42:90: cannot use rlimit.Max (variable of type int64) as type uint64 in argument to limitToString Reverting this commit to resolve the type mismatch error and maintain compatibility with the dragonfly integration. Signed-off-by: Julien Pivotto --- util/runtime/limits_default.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/util/runtime/limits_default.go b/util/runtime/limits_default.go index 1588a93c7..cd0ce732f 100644 --- a/util/runtime/limits_default.go +++ b/util/runtime/limits_default.go @@ -39,7 +39,9 @@ func getLimits(resource int, unit string) string { if err != nil { panic("syscall.Getrlimit failed: " + err.Error()) } - return fmt.Sprintf("(soft=%s, hard=%s)", limitToString(rlimit.Cur, unit), limitToString(rlimit.Max, unit)) + // rlimit.Cur and rlimit.Max are int64 on some platforms, such as dragonfly. + // We need to cast them explicitly to uint64. + return fmt.Sprintf("(soft=%s, hard=%s)", limitToString(uint64(rlimit.Cur), unit), limitToString(uint64(rlimit.Max), unit)) //nolint:unconvert } // FdLimits returns the soft and hard limits for file descriptors.