aboutsummaryrefslogtreecommitdiffhomepage
path: root/cmd
diff options
context:
space:
mode:
authorMohammed Al Sahaf <[email protected]>2024-01-02 08:48:55 +0300
committerGitHub <[email protected]>2024-01-02 08:48:55 +0300
commit787f6b257f3ee34431e4f5a9aa33a5399096a78c (patch)
tree207ea430559b5cb0d6c238bb96207a0466effcea /cmd
parentb568a10dd4feedd5539b181e26a5bbafebd4f984 (diff)
downloadcaddy-787f6b257f3ee34431e4f5a9aa33a5399096a78c.tar.gz
caddy-787f6b257f3ee34431e4f5a9aa33a5399096a78c.zip
chore: check against errors of `io/fs` instead of `os` (#6011)
* chore: replace `os.ErrNotExist` with `fs.ErrNotExist` * check against permission error from `io/fs` package
Diffstat (limited to 'cmd')
-rw-r--r--cmd/commandfuncs.go2
-rw-r--r--cmd/main.go3
2 files changed, 3 insertions, 2 deletions
diff --git a/cmd/commandfuncs.go b/cmd/commandfuncs.go
index b0c576a3d..746cf3da6 100644
--- a/cmd/commandfuncs.go
+++ b/cmd/commandfuncs.go
@@ -190,7 +190,7 @@ func cmdRun(fl Flags) (int, error) {
var config []byte
if resumeFlag {
config, err = os.ReadFile(caddy.ConfigAutosavePath)
- if os.IsNotExist(err) {
+ if errors.Is(err, fs.ErrNotExist) {
// not a bad error; just can't resume if autosave file doesn't exist
caddy.Log().Info("no autosave file exists", zap.String("autosave_file", caddy.ConfigAutosavePath))
resumeFlag = false
diff --git a/cmd/main.go b/cmd/main.go
index fa15c0874..73d70f04d 100644
--- a/cmd/main.go
+++ b/cmd/main.go
@@ -21,6 +21,7 @@ import (
"flag"
"fmt"
"io"
+ "io/fs"
"log"
"net"
"os"
@@ -128,7 +129,7 @@ func loadConfigWithLogger(logger *zap.Logger, configFile, adapterName string) ([
cfgAdapter = caddyconfig.GetAdapter("caddyfile")
if cfgAdapter != nil {
config, err = os.ReadFile("Caddyfile")
- if os.IsNotExist(err) {
+ if errors.Is(err, fs.ErrNotExist) {
// okay, no default Caddyfile; pretend like this never happened
cfgAdapter = nil
} else if err != nil {