diff --git a/realize/tools.go b/realize/tools.go index bbefa9c..ae0b36f 100644 --- a/realize/tools.go +++ b/realize/tools.go @@ -3,6 +3,7 @@ package realize import ( "bytes" "errors" + "io/ioutil" "os/exec" "path/filepath" "strings" @@ -95,6 +96,18 @@ func (t *Tool) Exec(path string, stop <-chan bool) (response Response) { if filepath.Ext(path) != "" { path = filepath.Dir(path) } + // check if there is at least one go file + matched := false + files, _ := ioutil.ReadDir(path) + for _, f := range files { + matched, _ = filepath.Match("*.go", f.Name()) + if matched { + break + } + } + if !matched { + return + } } else if !strings.HasSuffix(path, ".go") { return }