diff options
author | Sebastiaan van Stijn <github@gone.nl> | 2022-10-05 10:47:28 +0200 |
---|---|---|
committer | Sebastiaan van Stijn <github@gone.nl> | 2022-11-05 18:30:16 +0100 |
commit | cf1e138ab19bd0ace57d9ba418de514dd7a57b70 (patch) | |
tree | 51eae1ae9516a5a7947449682404ebdd42fb7052 | |
parent | afdc9a804aa7b25cfdfe899a89796b151a47657f (diff) | |
download | docker-cf1e138ab19bd0ace57d9ba418de514dd7a57b70.tar.gz |
pkg/directory: Size(): add back type-casts to account for platform differences
I noticed the comment above this code, but didn't see a corresponding type-cast.
Looking at this file's history, I found that these were removed as part of
2f5f0af3fdb7e9ee607a0e178dbe2af6e10cccf4, which looks to have overlooked some
deliberate type-casts.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 0a861e68df30a5d1e72bac99fe259149507cf354)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
-rw-r--r-- | pkg/directory/directory_unix.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/pkg/directory/directory_unix.go b/pkg/directory/directory_unix.go index eeedff18a4..a8bc41093f 100644 --- a/pkg/directory/directory_unix.go +++ b/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 |