Merge pull request #29 from ae0000/master

gofmt only applies to *.go files
This commit is contained in:
Alessio Pracchia 2016-11-25 12:49:08 +01:00 committed by GitHub
commit af6e3f944c
1 changed files with 3 additions and 2 deletions

View File

@ -3,7 +3,6 @@ package cli
import ( import (
"errors" "errors"
"fmt" "fmt"
"github.com/fsnotify/fsnotify"
"log" "log"
"math/big" "math/big"
"os" "os"
@ -13,6 +12,8 @@ import (
"sync" "sync"
"syscall" "syscall"
"time" "time"
"github.com/fsnotify/fsnotify"
) )
// Watching method is the main core. It manages the livereload and the watching // 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() { defer func() {
p.sync() p.sync()
}() }()
if p.Fmt { if p.Fmt && strings.HasSuffix(path, ".go") {
if stream, err := p.goFmt(path); err != nil { 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)) 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} out := BufferOut{Time: time.Now(), Text: "there are some errors in", Path: path, Type: "Go Fmt", Stream: stream}