diff options
Diffstat (limited to 'brewcheck.go')
| -rw-r--r-- | brewcheck.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/brewcheck.go b/brewcheck.go index 51d8e17..677b2d7 100644 --- a/brewcheck.go +++ b/brewcheck.go @@ -11,14 +11,14 @@ import ( "github.com/fatih/color" ) -const cacheTTL = 3 * 24 * time.Hour // 3 days +const TTL = 3 * 24 * time.Hour // 3 days func EnsureBrewAvailable() { - cacheFile := filepath.Join(xdg.CacheHome, "wthis", "brew-checked") + cache := filepath.Join(xdg.CacheHome, "wthis", "brew-checked") // 1. check if cache file exists and is fresh - if info, err := os.Stat(cacheFile); err == nil { - if time.Since(info.ModTime()) < cacheTTL { + if info, err := os.Stat(cache); err == nil { + if time.Since(info.ModTime()) < TTL { return // recently verified that brew exists } } @@ -32,6 +32,6 @@ func EnsureBrewAvailable() { } // 3. write cache - _ = os.MkdirAll(filepath.Dir(cacheFile), 0o755) - _ = os.WriteFile(cacheFile, []byte{}, 0o644) + _ = os.MkdirAll(filepath.Dir(cache), 0o755) + _ = os.WriteFile(cache, []byte{}, 0o644) } |
