From bf533496aa9e46694dd41146d5992fea7d4e81d6 Mon Sep 17 00:00:00 2001 From: Andrew Date: Fri, 25 Nov 2016 22:37:13 +1100 Subject: [PATCH] gofmt only applies to *.go files --- watcher/watcher.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/watcher/watcher.go b/watcher/watcher.go index 468f303..a8d82a4 100644 --- a/watcher/watcher.go +++ b/watcher/watcher.go @@ -3,7 +3,6 @@ package cli import ( "errors" "fmt" - "github.com/fsnotify/fsnotify" "log" "math/big" "os" @@ -13,6 +12,8 @@ import ( "sync" "syscall" "time" + + "github.com/fsnotify/fsnotify" ) // Watching method is the main core. It manages the livereload and the watching @@ -147,7 +148,7 @@ func (p *Project) fmt(path string) error { defer func() { p.sync() }() - if p.Fmt { + if p.Fmt && strings.HasSuffix(path, ".go") { if stream, err := p.goFmt(path); err != nil { msg := fmt.Sprintln(p.pname(p.Name, 2), ":", p.Red.Bold("Go Fmt"), p.Red.Regular("there are some errors in"), ":", p.Magenta.Bold(path)) out := BufferOut{Time: time.Now(), Text: "there are some errors in", Path: path, Type: "Go Fmt", Stream: stream}