Skip to content

Commit fb7d6db

Browse files
committed
Make dirList return empty slice instead of error
If directory does not exist. Returning an error causes the template it fail to render.
1 parent 11ae0d3 commit fb7d6db

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

template.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,8 @@ func dirList(path string) ([]string, error) {
368368
names := []string{}
369369
files, err := ioutil.ReadDir(path)
370370
if err != nil {
371-
return names, err
371+
log.Printf("Template error: %v", err)
372+
return names, nil
372373
}
373374
for _, f := range files {
374375
names = append(names, f.Name())

0 commit comments

Comments
 (0)