Skip to content

Commit c1c963a

Browse files
committed
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 <[email protected]>
1 parent 6bf1923 commit c1c963a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

libpod/info.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,14 +231,15 @@ func (r *Runtime) storeInfo() (*define.StoreInfo, error) {
231231
if err := syscall.Statfs(r.store.GraphRoot(), &grStats); err != nil {
232232
return nil, fmt.Errorf("unable to collect graph root usage for %q: %w", r.store.GraphRoot(), err)
233233
}
234-
allocated := uint64(grStats.Bsize) * grStats.Blocks
234+
bsize := uint64(grStats.Bsize) //nolint:unconvert,nolintlint // Bsize is not always uint64 on Linux.
235+
allocated := bsize * grStats.Blocks
235236
info := define.StoreInfo{
236237
ImageStore: imageInfo,
237238
ImageCopyTmpDir: os.Getenv("TMPDIR"),
238239
ContainerStore: conInfo,
239240
GraphRoot: r.store.GraphRoot(),
240241
GraphRootAllocated: allocated,
241-
GraphRootUsed: allocated - (uint64(grStats.Bsize) * grStats.Bfree),
242+
GraphRootUsed: allocated - (bsize * grStats.Bfree),
242243
RunRoot: r.store.RunRoot(),
243244
GraphDriverName: r.store.GraphDriverName(),
244245
GraphOptions: nil,

0 commit comments

Comments
 (0)