mirror of https://github.com/golang/go.git
clean cache on fs.ErrNotExist and fs.ErrPermission
This commit is contained in:
parent
1ef021d167
commit
cb0dac6448
|
|
@ -7,6 +7,7 @@ package net
|
|||
import (
|
||||
"errors"
|
||||
"internal/bytealg"
|
||||
"io/fs"
|
||||
"net/netip"
|
||||
"sync"
|
||||
"time"
|
||||
|
|
@ -66,10 +67,7 @@ func readHosts() {
|
|||
|
||||
file, err := open(hp)
|
||||
if err != nil {
|
||||
// Return only on temporary errors (EMFILE, ENFILE), so that
|
||||
// the hosts cache gets cleaned up on errors like: access, file not exist.
|
||||
var temporary interface{ Temporary() bool }
|
||||
if errors.As(err, &temporary) && temporary.Temporary() {
|
||||
if !errors.Is(err, fs.ErrNotExist) && !errors.Is(err, fs.ErrPermission) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue