@@ -40,7 +40,7 @@ control systems. Setting GOPROXY to "off" disallows downloading modules from
40
40
any source. Otherwise, GOPROXY is expected to be a comma-separated list of
41
41
the URLs of module proxies, in which case the go command will fetch modules
42
42
from those proxies. For each request, the go command tries each proxy in sequence,
43
- only moving to the next if the current proxy returns a 404 or 410 HTTP response .
43
+ only moving to the next if the current proxy failed .
44
44
The string "direct" may appear in the proxy list, to cause a direct connection to
45
45
be attempted at that point in the search.
46
46
@@ -415,7 +415,7 @@ func (r *lazyRepo) Zip(dst io.Writer, version string) error {
415
415
// The list must be non-empty and all Repos
416
416
// must return the same result from ModulePath.
417
417
// For each method, the repos are tried in order
418
- // until one succeeds or returns a non-ErrNotExist (non-404) error .
418
+ // until one succeeds.
419
419
type listRepo []Repo
420
420
421
421
func (l listRepo ) ModulePath () string {
@@ -425,49 +425,55 @@ func (l listRepo) ModulePath() string {
425
425
func (l listRepo ) Versions (prefix string ) ([]string , error ) {
426
426
for i , r := range l {
427
427
v , err := r .Versions (prefix )
428
- if i == len (l )- 1 || ! errors . Is ( err , os . ErrNotExist ) {
429
- return v , err
428
+ if err != nil && i != len (l ) - 1 {
429
+ continue
430
430
}
431
+ return v , err
431
432
}
432
433
panic ("no repos" )
433
434
}
434
435
435
436
func (l listRepo ) Stat (rev string ) (* RevInfo , error ) {
436
437
for i , r := range l {
437
438
info , err := r .Stat (rev )
438
- if i == len (l )- 1 || ! errors . Is ( err , os . ErrNotExist ) {
439
- return info , err
439
+ if err != nil && i != len (l ) - 1 {
440
+ continue
440
441
}
442
+ return info , err
441
443
}
442
444
panic ("no repos" )
443
445
}
444
446
445
447
func (l listRepo ) Latest () (* RevInfo , error ) {
446
448
for i , r := range l {
447
449
info , err := r .Latest ()
448
- if i == len (l )- 1 || ! errors . Is ( err , os . ErrNotExist ) {
449
- return info , err
450
+ if err != nil && i != len (l ) - 1 {
451
+ continue
450
452
}
453
+ return info , err
451
454
}
452
455
panic ("no repos" )
453
456
}
454
457
455
458
func (l listRepo ) GoMod (version string ) ([]byte , error ) {
456
459
for i , r := range l {
457
460
data , err := r .GoMod (version )
458
- if i == len (l )- 1 || ! errors . Is ( err , os . ErrNotExist ) {
459
- return data , err
461
+ if err != nil && i != len (l ) - 1 {
462
+ continue
460
463
}
464
+ return data , err
461
465
}
462
466
panic ("no repos" )
463
467
}
464
468
465
469
func (l listRepo ) Zip (dst io.Writer , version string ) error {
466
470
for i , r := range l {
467
471
err := r .Zip (dst , version )
468
- if i == len (l )- 1 || ! errors . Is ( err , os . ErrNotExist ) {
469
- return err
472
+ if err != nil && i != len (l ) - 1 {
473
+ continue
470
474
}
475
+ return err
471
476
}
472
477
panic ("no repos" )
473
478
}
479
+
0 commit comments