From c1c963affe137fa03a9dcd420c3241096723fa32 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Tue, 1 Apr 2025 14:48:59 -0700 Subject: [PATCH] libpod: fix unconvert linter warning When linting for freebsd, Stat_t Bsize is always uint64, thus the following warning: > libpod/info.go:234:21: unnecessary conversion (unconvert) > allocated := uint64(grStats.Bsize) * grStats.Blocks > ^ Use an intermediate variable to save on linter annotations. Signed-off-by: Kir Kolyshkin --- libpod/info.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libpod/info.go b/libpod/info.go index bb514adfb9..550b279ac0 100644 --- a/libpod/info.go +++ b/libpod/info.go @@ -231,14 +231,15 @@ func (r *Runtime) storeInfo() (*define.StoreInfo, error) { if err := syscall.Statfs(r.store.GraphRoot(), &grStats); err != nil { return nil, fmt.Errorf("unable to collect graph root usage for %q: %w", r.store.GraphRoot(), err) } - allocated := uint64(grStats.Bsize) * grStats.Blocks + bsize := uint64(grStats.Bsize) //nolint:unconvert,nolintlint // Bsize is not always uint64 on Linux. + allocated := bsize * grStats.Blocks info := define.StoreInfo{ ImageStore: imageInfo, ImageCopyTmpDir: os.Getenv("TMPDIR"), ContainerStore: conInfo, GraphRoot: r.store.GraphRoot(), GraphRootAllocated: allocated, - GraphRootUsed: allocated - (uint64(grStats.Bsize) * grStats.Bfree), + GraphRootUsed: allocated - (bsize * grStats.Bfree), RunRoot: r.store.RunRoot(), GraphDriverName: r.store.GraphDriverName(), GraphOptions: nil,