From 1ef021d167e987478f6610c91874b78dbac2f6d9 Mon Sep 17 00:00:00 2001 From: Mateusz Poliwczak Date: Sat, 6 May 2023 11:41:05 +0200 Subject: [PATCH] simplify --- src/net/hosts.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/net/hosts.go b/src/net/hosts.go index 2ab4573ea69..0e5a30bb476 100644 --- a/src/net/hosts.go +++ b/src/net/hosts.go @@ -7,7 +7,6 @@ package net import ( "errors" "internal/bytealg" - "io/fs" "net/netip" "sync" "time" @@ -67,12 +66,10 @@ func readHosts() { file, err := open(hp) if err != nil { - // Return only on temporary errors, so that - // the hosts cache gets cleaned up on errors - // like: access, file not exist errors. - var pathError *fs.PathError + // 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, &pathError) && errors.As(pathError.Err, &temporary) && temporary.Temporary() { + if errors.As(err, &temporary) && temporary.Temporary() { return } }