]> Nishi Git Mirror - aya.git/commitdiff
lint
authorIzuru Yakumo <yakumo.izuru@chaotic.ninja>
Mon, 17 Jun 2024 15:43:09 +0000 (12:43 -0300)
committerIzuru Yakumo <yakumo.izuru@chaotic.ninja>
Mon, 17 Jun 2024 15:43:09 +0000 (12:43 -0300)
Signed-off-by: Izuru Yakumo <yakumo.izuru@chaotic.ninja>
.gitignore
cmd/aya/buildall.go

index 01a871687d17346732fd3204bad567296f9575c5..094cf1a5849b9774b6968d28184e0601cd014200 100644 (file)
@@ -1,6 +1,7 @@
 *~
 *.bak
 **.pub
+*.sw*
 
 /aya
 /dist
index b39b3f742c26718363670cfa51a9bece1479b8b5..690c31adfd73325ad0183a82cf6f6c4bb2b01989 100644 (file)
@@ -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)
+       }
 }