From 71990c4f7c184d69034a346ae47ef471536be33d Mon Sep 17 00:00:00 2001 From: abs3nt Date: Sun, 5 Mar 2023 23:26:09 -0800 Subject: [PATCH] clean --- cmd/remove.go | 2 +- src/haunt/cli.go | 8 ++++---- src/haunt/notify.go | 4 ++-- src/haunt/projects.go | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cmd/remove.go b/cmd/remove.go index b965036..7d642d6 100644 --- a/cmd/remove.go +++ b/cmd/remove.go @@ -47,7 +47,7 @@ func remove(cmd *cobra.Command, args []string) (err error) { return err } for _, arg := range args { - err := r.Remove(arg) + err = r.Remove(arg) if err != nil { log.Println(r.Prefix(haunt.Red.Bold(arg + " project not found"))) continue diff --git a/src/haunt/cli.go b/src/haunt/cli.go index 8dd8fee..3cb18f0 100644 --- a/src/haunt/cli.go +++ b/src/haunt/cli.go @@ -81,9 +81,9 @@ func (r *Haunt) SetDefaults() { r.Settings.FileLimit = 0 r.Settings.Legacy.Interval = 100 * time.Millisecond r.Settings.Legacy.Force = false - r.Settings.Files.Errors = Resource{Name: FileErr, Status: false} - r.Settings.Files.Errors = Resource{Name: FileOut, Status: false} - r.Settings.Files.Errors = Resource{Name: FileLog, Status: false} + r.Settings.Errors = Resource{Name: FileErr, Status: false} + r.Settings.Errors = Resource{Name: FileOut, Status: false} + r.Settings.Errors = Resource{Name: FileLog, Status: false} if _, err := os.Stat("main.go"); err == nil { log.Println(r.Prefix(Green.Bold("Adding: " + filepath.Base(Wdir())))) r.Projects = append(r.Projects, Project{ @@ -137,7 +137,7 @@ func (r *Haunt) SetDefaults() { // Stop haunt workflow func (r *Haunt) Stop() error { - for k := range r.Schema.Projects { + for k := range r.Projects { if r.Schema.Projects[k].exit != nil { close(r.Schema.Projects[k].exit) } diff --git a/src/haunt/notify.go b/src/haunt/notify.go index ade104e..55a4232 100644 --- a/src/haunt/notify.go +++ b/src/haunt/notify.go @@ -250,13 +250,13 @@ func (w *filePoller) watch(f *os.File, lastFi os.FileInfo, chClose chan struct{} // If it doesn't exist at this point, it must have been removed // no need to send the error here since this is a valid operation if os.IsNotExist(err) { - if err := w.sendEvent(fsnotify.Event{Op: fsnotify.Remove, Name: f.Name()}, chClose); err != nil { + if err = w.sendEvent(fsnotify.Event{Op: fsnotify.Remove, Name: f.Name()}, chClose); err != nil { return } lastFi = nil } // at this point, send the error - err := w.sendErr(err, chClose) + err = w.sendErr(err, chClose) if err != nil { log.Println(log.Prefix(), err.Error()) } diff --git a/src/haunt/projects.go b/src/haunt/projects.go index 4563abd..7599c85 100644 --- a/src/haunt/projects.go +++ b/src/haunt/projects.go @@ -591,7 +591,7 @@ func (p *Project) run(path string, stream chan Response, stop <-chan bool) (err // https://github.com/golang/go/issues/5615 // https://github.com/golang/go/issues/6720 if build != nil { - err := build.Process.Signal(os.Interrupt) + err = build.Process.Signal(os.Interrupt) if err != nil { log.Println(p.parent.Prefix("Failed to send interrupt: " + err.Error())) } @@ -635,9 +635,9 @@ func (p *Project) run(path string, stream chan Response, stop <-chan bool) (err if p.Tools.Run.Method != "" { path = p.Tools.Run.Method } - if _, err := os.Stat(path); err == nil { + if _, err = os.Stat(path); err == nil { build = exec.Command(path, args...) - } else if _, err := os.Stat(path + RExtWin); err == nil { + } else if _, err = os.Stat(path + RExtWin); err == nil { build = exec.Command(path+RExtWin, args...) } else { if _, err = os.Stat(path); err == nil {