aboutsummaryrefslogtreecommitdiff
path: root/ciigo.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2025-01-06 02:51:20 +0700
committerShulhan <ms@kilabit.info>2025-01-07 00:13:55 +0700
commit4a4ed2dce4ea4d9448d5aa03ea4040af202d2520 (patch)
tree0ef6ce57392ff9a7dbfe2301ce0a16c5ddb2536e /ciigo.go
parentb686ea0a41b7af68d4d86ff3cc2c3068ebb88b66 (diff)
downloadciigo-4a4ed2dce4ea4d9448d5aa03ea4040af202d2520.tar.xz
all: ignore error when scanning for file markups
When listing the file markups, if the node is symlink (either file or directory) and target its not exist, continue to the next node instead of returning error. The same is true for directory that cannot be opened, probably due to broken symlink or permission.
Diffstat (limited to 'ciigo.go')
-rw-r--r--ciigo.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/ciigo.go b/ciigo.go
index 5069252..4ae8a7b 100644
--- a/ciigo.go
+++ b/ciigo.go
@@ -162,10 +162,8 @@ func listFileMarkups(dir string, excRE []*regexp.Regexp) (
d, err = os.Open(dir)
if err != nil {
- if os.IsPermission(err) {
- return nil, nil
- }
- return nil, fmt.Errorf(`%s: %w`, logp, err)
+ log.Printf(`%s: %s`, logp, err)
+ return nil, nil
}
fis, err = d.Readdir(0)
@@ -186,7 +184,9 @@ func listFileMarkups(dir string, excRE []*regexp.Regexp) (
if fi.Mode()&os.ModeSymlink == os.ModeSymlink {
fi, err = os.Stat(filePath)
if err != nil {
- return nil, fmt.Errorf(`%s: %w`, logp, err)
+ // Broken symlink.
+ log.Printf(`%s: %s`, logp, err)
+ continue
}
}