---
This patch prevents a panic when 'static_dir' does not exist.
I choose to simply log it and let the build succeed.
If you prefer, I can change it to abort the build.
Olivier
PS: thank you adnano for your open-source contributions!
main.go | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/main.go b/main.go
index 39fb70c..b081099 100644
--- a/main.go
+++ b/main.go
@@ -88,6 +88,10 @@ func (s *Site) runTask(task *Task) error {
if task.StaticDir != "" {
err := copyAll(task.StaticDir, task.OutputDir)
if err != nil {
+ if os.IsNotExist(err) {
+ log.Printf("static_dir '%s' does not exist\n", task.StaticDir)
+ return nil
+ }
return err
}
}
@@ -96,6 +100,9 @@ func (s *Site) runTask(task *Task) error {
func copyAll(srcDir, dstDir string) error {
return filepath.Walk(srcDir, func(path string, info fs.FileInfo, err error) error {
+ if err != nil {
+ return err
+ }
if info.IsDir() {
// Do nothing
return nil
--
2.33.0