@@ -11,8 +11,10 @@ import (
1111 "go.jetpack.io/pkg/cachehash"
1212)
1313
14- var NotFound = errors .New ("not found" )
15- var Expired = errors .New ("expired" )
14+ var (
15+ NotFound = errors .New ("not found" )
16+ Expired = errors .New ("expired" )
17+ )
1618
1719type Cache [T any ] struct {
1820 domain string
@@ -55,7 +57,7 @@ func (c *Cache[T]) Set(key string, val T, dur time.Duration) error {
5557 return errors .WithStack (err )
5658 }
5759
58- return errors .WithStack (os .WriteFile (c .filename (key ), d , 0644 ))
60+ return errors .WithStack (os .WriteFile (c .filename (key ), d , 0o644 ))
5961}
6062
6163// SetWithTime is like Set but it allows the caller to specify the expiration
@@ -66,7 +68,7 @@ func (c *Cache[T]) SetWithTime(key string, val T, t time.Time) error {
6668 return errors .WithStack (err )
6769 }
6870
69- return errors .WithStack (os .WriteFile (c .filename (key ), d , 0644 ))
71+ return errors .WithStack (os .WriteFile (c .filename (key ), d , 0o644 ))
7072}
7173
7274// Get retrieves a value from the cache with the given key.
@@ -142,6 +144,6 @@ func IsCacheMiss(err error) bool {
142144
143145func (c * Cache [T ]) filename (key string ) string {
144146 dir := filepath .Join (c .cacheDir , c .domain )
145- _ = os .MkdirAll (dir , 0755 )
147+ _ = os .MkdirAll (dir , 0o755 )
146148 return filepath .Join (dir , cachehash .Slug (key ))
147149}
0 commit comments