From 2da377c582eb054b0bca1ca3210701714993047f Mon Sep 17 00:00:00 2001 From: greatroar <61184462+greatroar@users.noreply.github.com> Date: Tue, 10 May 2022 18:52:39 +0200 Subject: [PATCH] cache: Don't Lstat before creating the tag file The tag file is opened with O_CREATE|O_EXCL and ErrExist is handled, so we don't need to check for existence first. --- internal/cache/cache.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/internal/cache/cache.go b/internal/cache/cache.go index 83013603b..a43b2bbf2 100644 --- a/internal/cache/cache.go +++ b/internal/cache/cache.go @@ -59,11 +59,6 @@ func writeCachedirTag(dir string) error { } tagfile := filepath.Join(dir, "CACHEDIR.TAG") - _, err := fs.Lstat(tagfile) - if err != nil && !errors.Is(err, os.ErrNotExist) { - return errors.WithStack(err) - } - f, err := fs.OpenFile(tagfile, os.O_CREATE|os.O_EXCL|os.O_WRONLY, fileMode) if err != nil { if errors.Is(err, os.ErrExist) {