Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ddddddO committed Jul 25, 2023
1 parent 5483882 commit 136b147
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion simple_tree_verifier.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package gtree

import (
"errors"
"fmt"
"io/fs"
"os"
Expand Down Expand Up @@ -51,11 +52,16 @@ func (dv *defaultVerifierSimple) verifyRoot(root *Node) ([]string, []string, err
rootPath := root.path()
fileSystem := os.DirFS(filepath.Join(dv.targetDir, rootPath))
err := fs.WalkDir(fileSystem, ".", func(path string, d fs.DirEntry, err error) error {
dir := filepath.Join(dv.targetDir, rootPath, path)

if err != nil {
if errors.Is(err, fs.ErrNotExist) {
// markdown上のrootが検査対象パスに無いとエラー
return VerifyError{noExists: []string{dir}}
}
return err
}

dir := filepath.Join(dv.targetDir, rootPath, path)
if _, ok := dirsMarkdown[dir]; !ok {
// Markdownに無いパスがディレクトリに有る => strictモードでエラー
existDirs = append(existDirs, dir)
Expand Down

0 comments on commit 136b147

Please sign in to comment.