diff --git a/main.go b/main.go index d1ba02d..6cdc6b5 100644 --- a/main.go +++ b/main.go @@ -396,9 +396,9 @@ func getVars(path string, globals Vars) (Vars, string, error) { return nil, "", nil } - b, err := ioutil.ReadFile(path) + b, err := os.ReadFile(path) if err != nil { - return nil, "", err + return nil, "", fmt.Errorf("error getting vars from %q: %w", path, err) } s := string(b) @@ -608,7 +608,7 @@ func buildAll(ctx context.Context, watch bool) error { return ctx.Err() case <-ticker.C: os.Mkdir(PUBDIR, 0755) - filepath.Walk(".", func(path string, info os.FileInfo, err error) error { + err := filepath.Walk(".", func(path string, info os.FileInfo, err error) error { // rebuild if changes to .zs/ or .zsignore if (filepath.Base(path) == ZSIGNORE || filepath.Dir(path) == ZSDIR) && info.ModTime().After(lastModified) { if filepath.Base(path) == ZSIGNORE { @@ -658,7 +658,7 @@ func buildAll(ctx context.Context, watch bool) error { } } if !watch { - return nil + return err } lastModified = time.Now() } diff --git a/testdata/simple/.zs/layout.html b/testdata/simple/.zs/layout.html index 5744e79..cddd070 100644 --- a/testdata/simple/.zs/layout.html +++ b/testdata/simple/.zs/layout.html @@ -1,3 +1 @@ - - {{ content }} - +{{ content }}