changeset 87:0b78d345c179 draft

lint Signed-off-by: Izuru Yakumo <yakumo.izuru@chaotic.ninja>
author yakumo.izuru
date Mon, 17 Jun 2024 15:43:09 +0000
parents 897d57a7ec95
children 01ae2ad18ed1
files .gitignore cmd/aya/buildall.go
diffstat 2 files changed, 41 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
--- a/.gitignore	Wed Apr 03 23:17:16 2024 +0000
+++ b/.gitignore	Mon Jun 17 15:43:09 2024 +0000
@@ -1,6 +1,7 @@
 *~
 *.bak
 **.pub
+*.sw*
 
 /aya
 /dist
--- a/cmd/aya/buildall.go	Wed Apr 03 23:17:16 2024 +0000
+++ b/cmd/aya/buildall.go	Mon Jun 17 15:43:09 2024 +0000
@@ -12,46 +12,46 @@
 )
 
 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)
+	}
 }