summaryrefslogtreecommitdiff
path: root/brewcheck.go
diff options
context:
space:
mode:
authorEltrac <hi@guhub.cn>2025-11-21 08:52:13 +0800
committerEltrac <hi@guhub.cn>2025-11-21 08:52:13 +0800
commitc2f95c4002c3a3324752b7308c36cd8a0465e9fd (patch)
treef3a924b651cfa105b2dd6ee4e3bac53bad87b581 /brewcheck.go
parent4528958c13a5047d1e9e30d266996c93175e3731 (diff)
style: rename vars shorter to be idiomatic and fix typo
Diffstat (limited to 'brewcheck.go')
-rw-r--r--brewcheck.go12
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)
}