@@ -46,7 +46,6 @@ type Cache struct {
4646// to share a cache directory (for example, if the directory were stored
4747// in a network file system). File locking is notoriously unreliable in
4848// network file systems and may not suffice to protect the cache.
49- //
5049func Open (dir string ) (* Cache , error ) {
5150 info , err := os .Stat (dir )
5251 if err != nil {
@@ -57,11 +56,11 @@ func Open(dir string) (*Cache, error) {
5756 }
5857 for i := 0 ; i < 256 ; i ++ {
5958 name := filepath .Join (dir , fmt .Sprintf ("%02x" , i ))
60- if err := os .MkdirAll (name , 0777 ); err != nil {
59+ if err := os .MkdirAll (name , 0o777 ); err != nil {
6160 return nil , err
6261 }
6362 }
64- f , err := os .OpenFile (filepath .Join (dir , "log.txt" ), os .O_WRONLY | os .O_APPEND | os .O_CREATE , 0666 )
63+ f , err := os .OpenFile (filepath .Join (dir , "log.txt" ), os .O_WRONLY | os .O_APPEND | os .O_CREATE , 0o666 )
6564 if err != nil {
6665 return nil , err
6766 }
@@ -283,7 +282,7 @@ func (c *Cache) Trim() {
283282 c .trimSubdir (subdir , cutoff )
284283 }
285284
286- ioutil .WriteFile (filepath .Join (c .dir , "trim.txt" ), []byte (fmt .Sprintf ("%d" , now .Unix ())), 0666 )
285+ ioutil .WriteFile (filepath .Join (c .dir , "trim.txt" ), []byte (fmt .Sprintf ("%d" , now .Unix ())), 0o666 )
287286}
288287
289288// trimSubdir trims a single cache subdirectory.
@@ -337,7 +336,7 @@ func (c *Cache) putIndexEntry(id ActionID, out OutputID, size int64, allowVerify
337336 }
338337 }
339338 file := c .fileName (id , "a" )
340- if err := ioutil .WriteFile (file , entry , 0666 ); err != nil {
339+ if err := ioutil .WriteFile (file , entry , 0o666 ); err != nil {
341340 os .Remove (file )
342341 return err
343342 }
@@ -414,7 +413,7 @@ func (c *Cache) copyFile(file io.ReadSeeker, out OutputID, size int64) error {
414413 if err == nil && info .Size () > size { // shouldn't happen but fix in case
415414 mode |= os .O_TRUNC
416415 }
417- f , err := os .OpenFile (name , mode , 0666 )
416+ f , err := os .OpenFile (name , mode , 0o666 )
418417 if err != nil {
419418 return err
420419 }
0 commit comments