checks folders only with gofmt #12

This commit is contained in:
alessio 2016-08-24 14:21:46 +02:00
parent 4aa4d27bb5
commit 867bd2c318
1 changed files with 7 additions and 8 deletions

View File

@ -197,9 +197,14 @@ func (p *Project) walks(watcher *fsnotify.Watcher) {
if inArray(filepath.Ext(path), p.Watcher.Exts) { if inArray(filepath.Ext(path), p.Watcher.Exts) {
files++ files++
} else { } else {
if err := p.fmt(path); err != nil {
fmt.Println(err)
}
folders++ folders++
} }
} }
} }
return nil return nil
} }
@ -213,14 +218,8 @@ func (p *Project) walks(watcher *fsnotify.Watcher) {
for _, dir := range p.Watcher.Paths { for _, dir := range p.Watcher.Paths {
base := filepath.Join(p.base, dir) base := filepath.Join(p.base, dir)
if _, err := os.Stat(base); err == nil { if _, err := os.Stat(base); err == nil {
if !p.ignore(base) { if err := filepath.Walk(base, walk); err != nil {
// check gofmt errors log.Println(Red(err.Error()))
if err := p.fmt(base); err != nil {
fmt.Println(err)
}
if err := filepath.Walk(base, walk); err != nil {
log.Println(Red(err.Error()))
}
} }
} else { } else {
fmt.Println(pname(p.Name, 1), ":\t", Red(base+" path doesn't exist")) fmt.Println(pname(p.Name, 1), ":\t", Red(base+" path doesn't exist"))