#86 fixed
This commit is contained in:
parent
3b3453da46
commit
9df2440e7a
|
@ -145,8 +145,8 @@ func (p *Project) goInstall() (string, error) {
|
|||
return "", nil
|
||||
}
|
||||
|
||||
// GoTools is used for run go methods such as fmt, test, generate...
|
||||
func (p *Project) goTools(dir string, name string, cmd ...string) (string, error) {
|
||||
// GoTool is used for run go methods such as fmt, test, generate...
|
||||
func (p *Project) goTool(dir string, name string, cmd ...string) (string, error) {
|
||||
if s := filepath.Ext(dir); s != "" && s != ".go" {
|
||||
return "", nil
|
||||
}
|
||||
|
|
|
@ -124,7 +124,6 @@ func (p *Project) watchByNotify() {
|
|||
if event.Op&fsnotify.Chmod == fsnotify.Chmod {
|
||||
continue
|
||||
}
|
||||
if _, err := os.Stat(event.Name); err == nil {
|
||||
var ext string
|
||||
if index := strings.Index(filepath.Ext(event.Name), "_"); index == -1 {
|
||||
ext = filepath.Ext(event.Name)
|
||||
|
@ -142,9 +141,14 @@ func (p *Project) watchByNotify() {
|
|||
msg = fmt.Sprintln(p.pname(p.Name, 4), ":", style.Magenta.Bold(strings.ToUpper(ext[1:])+" changed"), style.Magenta.Bold(file))
|
||||
out = BufferOut{Time: time.Now(), Text: strings.ToUpper(ext[1:]) + " changed " + file}
|
||||
p.stamp("log", out, msg, "")
|
||||
|
||||
// check if is deleted
|
||||
if event.Op&fsnotify.Remove == fsnotify.Remove {
|
||||
go p.routines(&wr, channel, watcher, "")
|
||||
}else{
|
||||
go p.routines(&wr, channel, watcher, file)
|
||||
p.LastChangedOn = time.Now().Truncate(time.Second)
|
||||
}
|
||||
p.LastChangedOn = time.Now().Truncate(time.Second)
|
||||
}
|
||||
}
|
||||
case err := <-watcher.Errors:
|
||||
|
@ -267,7 +271,7 @@ func (p *Project) tool(path string, tool tool) error {
|
|||
tool.options = append(tool.options, path)
|
||||
path = p.base
|
||||
}
|
||||
if stream, err := p.goTools(path, tool.cmd, tool.options...); err != nil {
|
||||
if stream, err := p.goTool(path, tool.cmd, tool.options...); err != nil {
|
||||
msg = fmt.Sprintln(p.pname(p.Name, 2), ":", style.Red.Bold(tool.name), style.Red.Regular("there are some errors in"), ":", style.Magenta.Bold(path))
|
||||
out = BufferOut{Time: time.Now(), Text: "there are some errors in", Path: path, Type: tool.name, Stream: stream}
|
||||
p.stamp("error", out, msg, stream)
|
||||
|
|
Loading…
Reference in New Issue