mirror of
https://github.com/caddyserver/caddy.git
synced 2025-05-24 11:41:19 +08:00
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
This commit is contained in:

committed by
GitHub

parent
b568a10dd4
commit
787f6b257f
3
caddy.go
3
caddy.go
@ -22,6 +22,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/fs"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
@ -828,7 +829,7 @@ func InstanceID() (uuid.UUID, error) {
|
||||
appDataDir := AppDataDir()
|
||||
uuidFilePath := filepath.Join(appDataDir, "instance.uuid")
|
||||
uuidFileBytes, err := os.ReadFile(uuidFilePath)
|
||||
if os.IsNotExist(err) {
|
||||
if errors.Is(err, fs.ErrNotExist) {
|
||||
uuid, err := uuid.NewRandom()
|
||||
if err != nil {
|
||||
return uuid, err
|
||||
|
Reference in New Issue
Block a user