From 2b7e2c6752800b721a3d40bf8d9abe5df4969fb8 Mon Sep 17 00:00:00 2001 From: Sasha Melentyev Date: Sun, 10 Jul 2022 20:07:17 +0300 Subject: [PATCH] fix: change err to nil --- pkg/commands/cache.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/pkg/commands/cache.go b/pkg/commands/cache.go index ac3a3ee63fcc..904c2a1fc5c1 100644 --- a/pkg/commands/cache.go +++ b/pkg/commands/cache.go @@ -73,11 +73,8 @@ func (e *Executor) executeCacheStatus(_ *cobra.Command, args []string) { func dirSizeBytes(path string) (int64, error) { var size int64 err := filepath.Walk(path, func(_ string, info os.FileInfo, err error) error { - if err != nil { - return err - } - if !info.IsDir() { - size += info.Size() + if err == nil && !info.IsDir() { + size = info.Size() } return err })