@@ -73,12 +73,12 @@ func Download(ctx context.Context, mod module.Version) (dir string, err error) {
7373// Unzip is like Download but is given the explicit zip file to use,
7474// rather than downloading it. This is used for the GOFIPS140 zip files,
7575// which ship in the Go distribution itself.
76- func Unzip (ctx context.Context , mod module.Version , zipfile string ) (dir string , err error ) {
76+ func ( f * Fetcher ) Unzip (ctx context.Context , mod module.Version , zipfile string ) (dir string , err error ) {
7777 if err := checkCacheDir (ctx ); err != nil {
7878 base .Fatal (err )
7979 }
8080
81- return Fetcher_ .downloadCache .Do (mod , func () (string , error ) {
81+ return f .downloadCache .Do (mod , func () (string , error ) {
8282 ctx , span := trace .StartSpan (ctx , "modfetch.Unzip " + mod .String ())
8383 defer span .Done ()
8484
@@ -171,10 +171,10 @@ func unzip(ctx context.Context, mod module.Version, zipfile string) (dir string,
171171 // Go 1.14.2 and higher respect .partial files. Older versions may use
172172 // partially extracted directories. 'go mod verify' can detect this,
173173 // and 'go clean -modcache' can fix it.
174- if err := os .MkdirAll (parentDir , 0777 ); err != nil {
174+ if err := os .MkdirAll (parentDir , 0o777 ); err != nil {
175175 return "" , err
176176 }
177- if err := os .WriteFile (partialPath , nil , 0666 ); err != nil {
177+ if err := os .WriteFile (partialPath , nil , 0o666 ); err != nil {
178178 return "" , err
179179 }
180180 if err := modzip .Unzip (dir , mod , zipfile ); err != nil {
@@ -264,7 +264,7 @@ func downloadZip(ctx context.Context, mod module.Version, zipfile string) (err e
264264 }
265265
266266 // Create parent directories.
267- if err := os .MkdirAll (filepath .Dir (zipfile ), 0777 ); err != nil {
267+ if err := os .MkdirAll (filepath .Dir (zipfile ), 0o777 ); err != nil {
268268 return err
269269 }
270270
@@ -289,7 +289,7 @@ func downloadZip(ctx context.Context, mod module.Version, zipfile string) (err e
289289 // contents of the file (by hashing it) before we commit it. Because the file
290290 // is zip-compressed, we need an actual file — or at least an io.ReaderAt — to
291291 // validate it: we can't just tee the stream as we write it.
292- f , err := tempFile (ctx , filepath .Dir (zipfile ), filepath .Base (zipfile ), 0666 )
292+ f , err := tempFile (ctx , filepath .Dir (zipfile ), filepath .Base (zipfile ), 0o666 )
293293 if err != nil {
294294 return err
295295 }
@@ -404,7 +404,7 @@ func makeDirsReadOnly(dir string) {
404404 filepath .WalkDir (dir , func (path string , d fs.DirEntry , err error ) error {
405405 if err == nil && d .IsDir () {
406406 info , err := d .Info ()
407- if err == nil && info .Mode ()& 0222 != 0 {
407+ if err == nil && info .Mode ()& 0o222 != 0 {
408408 dirs = append (dirs , pathMode {path , info .Mode ()})
409409 }
410410 }
@@ -413,7 +413,7 @@ func makeDirsReadOnly(dir string) {
413413
414414 // Run over list backward to chmod children before parents.
415415 for i := len (dirs ) - 1 ; i >= 0 ; i -- {
416- os .Chmod (dirs [i ].path , dirs [i ].mode &^0222 )
416+ os .Chmod (dirs [i ].path , dirs [i ].mode &^0o222 )
417417 }
418418}
419419
@@ -426,7 +426,7 @@ func RemoveAll(dir string) error {
426426 return nil // ignore errors walking in file system
427427 }
428428 if info .IsDir () {
429- os .Chmod (path , 0777 )
429+ os .Chmod (path , 0o777 )
430430 }
431431 return nil
432432 })
@@ -970,7 +970,6 @@ Outer:
970970 tidyGoSum := tidyGoSum (data , keep )
971971 return tidyGoSum , nil
972972 })
973-
974973 if err != nil {
975974 return fmt .Errorf ("updating go.sum: %w" , err )
976975 }
0 commit comments