From 3f8a008d43470b800d3155e7912ae7e6625c25fb Mon Sep 17 00:00:00 2001 From: Izuru Yakumo Date: Mon, 17 Jun 2024 12:43:09 -0300 Subject: [PATCH] lint Signed-off-by: Izuru Yakumo --- .gitignore | 1 + cmd/aya/buildall.go | 80 ++++++++++++++++++++++----------------------- 2 files changed, 41 insertions(+), 40 deletions(-) diff --git a/.gitignore b/.gitignore index 01a8716..094cf1a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ *~ *.bak **.pub +*.sw* /aya /dist diff --git a/cmd/aya/buildall.go b/cmd/aya/buildall.go index b39b3f7..690c31a 100644 --- a/cmd/aya/buildall.go +++ b/cmd/aya/buildall.go @@ -12,46 +12,46 @@ import ( ) func buildAll(watch bool) { - lastModified := time.Unix(0, 0) - modified := false + lastModified := time.Unix(0, 0) + modified := false - vars := globals() - for { - os.Mkdir(PUBDIR, 0755) - filepath.Walk(".", func(path string, info os.FileInfo, err error) error { - // ignore hidden files and directories - if filepath.Base(path)[0] == '.' || strings.HasPrefix(path, ".") { - return nil - } - // inform user about fs walk errors, but continue iteration - if err != nil { - fmt.Println("error:", err) - return nil - } + vars := globals() + for { + os.Mkdir(PUBDIR, 0755) + filepath.Walk(".", func(path string, info os.FileInfo, err error) error { + // ignore hidden files and directories + if filepath.Base(path)[0] == '.' || strings.HasPrefix(path, ".") { + return nil + } + // inform user about fs walk errors, but continue iteration + if err != nil { + fmt.Println("error:", err) + return nil + } - if info.IsDir() { - os.Mkdir(filepath.Join(PUBDIR, path), 0755) - return nil - } else if info.ModTime().After(lastModified) { - if !modified { - // First file in this build cycle is about to be modified - run(vars, "prehook") - modified = true - } - fmt.Println("GEN", path) - return build(path, nil, vars) - } - return nil - }) - if modified { - // At least one file in this build cycle has been modified - run(vars, "posthook") - modified = false - } - if !watch { - break - } - lastModified = time.Now() - time.Sleep(1 * time.Second) - } + if info.IsDir() { + os.Mkdir(filepath.Join(PUBDIR, path), 0755) + return nil + } else if info.ModTime().After(lastModified) { + if !modified { + // First file in this build cycle is about to be modified + run(vars, "prehook") + modified = true + } + fmt.Println("GEN", path) + return build(path, nil, vars) + } + return nil + }) + if modified { + // At least one file in this build cycle has been modified + run(vars, "posthook") + modified = false + } + if !watch { + break + } + lastModified = time.Now() + time.Sleep(1 * time.Second) + } } -- 2.43.0