From e19622e4b1239d49eba93625faa6cf67dcef4b53 Mon Sep 17 00:00:00 2001 From: Alexandr Bruyako Date: Mon, 1 Jul 2019 00:26:00 +0300 Subject: [PATCH] start using fileMode const --- internal/cache/cache.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/cache/cache.go b/internal/cache/cache.go index 0b264e256..ca59b0dc0 100644 --- a/internal/cache/cache.go +++ b/internal/cache/cache.go @@ -24,7 +24,7 @@ type Cache struct { } const dirMode = 0700 -const fileMode = 0600 +const fileMode = 0644 func readVersion(dir string) (v uint, err error) { buf, err := ioutil.ReadFile(filepath.Join(dir, "version")) @@ -68,7 +68,7 @@ func writeCachedirTag(dir string) error { return errors.Wrap(err, "Lstat") } - f, err := fs.OpenFile(tagfile, os.O_CREATE|os.O_EXCL|os.O_WRONLY, 0644) + f, err := fs.OpenFile(tagfile, os.O_CREATE|os.O_EXCL|os.O_WRONLY, fileMode) if err != nil { if os.IsExist(errors.Cause(err)) { return nil @@ -138,7 +138,7 @@ func New(id string, basedir string) (c *Cache, err error) { } if v < cacheVersion { - err = ioutil.WriteFile(filepath.Join(cachedir, "version"), []byte(fmt.Sprintf("%d", cacheVersion)), 0644) + err = ioutil.WriteFile(filepath.Join(cachedir, "version"), []byte(fmt.Sprintf("%d", cacheVersion)), fileMode) if err != nil { return nil, errors.Wrap(err, "WriteFile") }