chore: enable early-return and superfluous-else from revive (#7129)

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
This commit is contained in:
Matthieu MOREL
2025-06-05 09:10:58 +02:00
committed by GitHub
parent ddb74cdcf4
commit 186e4a1dbb
8 changed files with 115 additions and 52 deletions

View File

@@ -96,11 +96,10 @@ func hostsParse(c *caddy.Controller) (Hosts, error) {
}
s, err := os.Stat(h.path)
if err != nil {
if os.IsNotExist(err) {
log.Warningf("File does not exist: %s", h.path)
} else {
if !os.IsNotExist(err) {
return h, c.Errf("unable to access hosts file '%s': %v", h.path, err)
}
log.Warningf("File does not exist: %s", h.path)
}
if s != nil && s.IsDir() {
log.Warningf("Hosts file %q is a directory", h.path)