package fs import ( "errors" "io/fs" ) func isNotFound(err error) bool { if err == nil { return false } var pathErr *fs.PathError if errors.As(err, &pathErr) { e := pathErr.Err return errors.Is(e, fs.ErrInvalid) || errors.Is(e, fs.ErrNotExist) } return false }