From cb0dac6448bbc337cd015ad4b4b3d1da3f14a561 Mon Sep 17 00:00:00 2001 From: Mateusz Poliwczak Date: Thu, 11 May 2023 09:33:24 +0200 Subject: [PATCH] clean cache on fs.ErrNotExist and fs.ErrPermission --- src/net/hosts.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/net/hosts.go b/src/net/hosts.go index 0e5a30bb47..56e6674144 100644 --- a/src/net/hosts.go +++ b/src/net/hosts.go @@ -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 } }