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 <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin 2025-04-01 14:48:59 -07:00
parent 6bf1923f3e
commit c1c963affe
1 changed files with 3 additions and 2 deletions

View File

@ -231,14 +231,15 @@ func (r *Runtime) storeInfo() (*define.StoreInfo, error) {
if err := syscall.Statfs(r.store.GraphRoot(), &grStats); err != nil { 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) 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{ info := define.StoreInfo{
ImageStore: imageInfo, ImageStore: imageInfo,
ImageCopyTmpDir: os.Getenv("TMPDIR"), ImageCopyTmpDir: os.Getenv("TMPDIR"),
ContainerStore: conInfo, ContainerStore: conInfo,
GraphRoot: r.store.GraphRoot(), GraphRoot: r.store.GraphRoot(),
GraphRootAllocated: allocated, GraphRootAllocated: allocated,
GraphRootUsed: allocated - (uint64(grStats.Bsize) * grStats.Bfree), GraphRootUsed: allocated - (bsize * grStats.Bfree),
RunRoot: r.store.RunRoot(), RunRoot: r.store.RunRoot(),
GraphDriverName: r.store.GraphDriverName(), GraphDriverName: r.store.GraphDriverName(),
GraphOptions: nil, GraphOptions: nil,