From: Izuru Yakumo Date: Mon, 17 Jun 2024 15:43:09 +0000 (-0300) Subject: lint X-Git-Tag: v1.0.6~1 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=3f8a008d43470b800d3155e7912ae7e6625c25fb;p=aya.git lint Signed-off-by: Izuru Yakumo --- 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) + } }