Skip to content

Commit

Permalink
chore: refactor code quality issues
Browse files Browse the repository at this point in the history
  • Loading branch information
akshgpt7 committed Mar 22, 2021
1 parent 9293bfa commit cdce34e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cmd/minify/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ func createTasks(inputs []string, output string) ([]Task, []string, error) {
return err
} else if d.Name() == "." || d.Name() == ".." {
return nil
} else if len(d.Name()) == 0 || !hidden && d.Name()[0] == '.' {
} else if d.Name() == "" || !hidden && d.Name()[0] == '.' {
if d.IsDir() {
return SkipDir
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/minify/watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func (w *Watcher) Run() chan string {

// check if changed file is being watched (as a file or indirectly in a dir)
watched := false
for path, _ := range w.paths {
for path := range w.paths {
if 0 < len(path) && path[len(path)-1] != '/' {
// file in w.paths
if path == filepath.Clean(event.Name) {
Expand All @@ -109,7 +109,7 @@ func (w *Watcher) Run() chan string {
}
} else if info.Mode().IsRegular() {
if event.Op&fsnotify.Write == fsnotify.Write {
if t, ok := changetimes[event.Name]; !ok || 100*time.Millisecond < time.Now().Sub(t) {
if t, ok := changetimes[event.Name]; !ok || 100*time.Millisecond < time.Since(t) {
time.Sleep(100 * time.Millisecond) // wait to make sure write is finished
files <- event.Name
changetimes[event.Name] = time.Now()
Expand Down

0 comments on commit cdce34e

Please sign in to comment.