Changeset 88 in code


Ignore:
Timestamp:
Jun 17, 2024, 3:43:09 PM (12 months ago)
Author:
Izuru Yakumo
Message:

lint

Signed-off-by: Izuru Yakumo <yakumo.izuru@…>

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/.gitignore

    r85 r88  
    22*.bak
    33**.pub
     4*.sw*
    45
    56/aya
  • trunk/cmd/aya/buildall.go

    r84 r88  
    1313
    1414func buildAll(watch bool) {
    15         lastModified := time.Unix(0, 0)
    16         modified := false
     15        lastModified := time.Unix(0, 0)
     16        modified := false
    1717
    18         vars := globals()
    19         for {
    20                 os.Mkdir(PUBDIR, 0755)
    21                 filepath.Walk(".", func(path string, info os.FileInfo, err error) error {
    22                         // ignore hidden files and directories
    23                         if filepath.Base(path)[0] == '.' || strings.HasPrefix(path, ".") {
    24                                 return nil
    25                         }
    26                         // inform user about fs walk errors, but continue iteration
    27                         if err != nil {
    28                                 fmt.Println("error:", err)
    29                                 return nil
    30                         }
     18        vars := globals()
     19        for {
     20                os.Mkdir(PUBDIR, 0755)
     21                filepath.Walk(".", func(path string, info os.FileInfo, err error) error {
     22                        // ignore hidden files and directories
     23                        if filepath.Base(path)[0] == '.' || strings.HasPrefix(path, ".") {
     24                                return nil
     25                        }
     26                        // inform user about fs walk errors, but continue iteration
     27                        if err != nil {
     28                                fmt.Println("error:", err)
     29                                return nil
     30                        }
    3131
    32                         if info.IsDir() {
    33  os.Mkdir(filepath.Join(PUBDIR, path), 0755)
    34                                 return nil
    35                         } else if info.ModTime().After(lastModified) {
    36                                 if !modified {
    37                                         // First file in this build cycle is about to be modified
    38                                         run(vars, "prehook")
    39                                         modified = true
    40                                 }
    41                                 fmt.Println("GEN", path)
    42                                 return build(path, nil, vars)
    43                         }
    44                         return nil
    45                 })
    46                 if modified {
    47                         // At least one file in this build cycle has been modified
    48                         run(vars, "posthook")
    49                         modified = false
    50                 }
    51                 if !watch {
    52                         break
    53                 }
    54                 lastModified = time.Now()
    55                 time.Sleep(1 * time.Second)
    56         }
     32                        if info.IsDir() {
     33                                os.Mkdir(filepath.Join(PUBDIR, path), 0755)
     34                                return nil
     35                        } else if info.ModTime().After(lastModified) {
     36                                if !modified {
     37                                        // First file in this build cycle is about to be modified
     38                                        run(vars, "prehook")
     39                                        modified = true
     40                                }
     41                                fmt.Println("GEN", path)
     42                                return build(path, nil, vars)
     43                        }
     44                        return nil
     45                })
     46                if modified {
     47                        // At least one file in this build cycle has been modified
     48                        run(vars, "posthook")
     49                        modified = false
     50                }
     51                if !watch {
     52                        break
     53                }
     54                lastModified = time.Now()
     55                time.Sleep(1 * time.Second)
     56        }
    5757}
Note: See TracChangeset for help on using the changeset viewer.