瀏覽代碼

Merge pull request #44250 from thaJeztah/fix_pkg_dir

pkg/directory: Size(): add back type-casts to account for platform differences
Sebastiaan van Stijn 2 年之前
父節點
當前提交
59c77c8f5b
共有 1 個文件被更改,包括 4 次插入4 次删除
  1. 4 4
      pkg/directory/directory_unix.go

+ 4 - 4
pkg/directory/directory_unix.go

@@ -40,12 +40,12 @@ func Size(ctx context.Context, dir string) (size int64, err error) {
 
 		// Check inode to handle hard links correctly
 		inode := fileInfo.Sys().(*syscall.Stat_t).Ino
-		// inode is not a uint64 on all platforms. Cast it to avoid issues.
-		if _, exists := data[inode]; exists {
+		//nolint:unconvert // inode is not an uint64 on all platforms.
+		if _, exists := data[uint64(inode)]; exists {
 			return nil
 		}
-		// inode is not a uint64 on all platforms. Cast it to avoid issues.
-		data[inode] = struct{}{}
+
+		data[uint64(inode)] = struct{}{} //nolint:unconvert // inode is not an uint64 on all platforms.
 
 		size += s