mirror of
https://github.com/beego/bee.git
synced 2024-11-22 05:00:54 +00:00
only watch go file's modify
This commit is contained in:
parent
058289f79d
commit
bf5f0baed7
11
watch.go
11
watch.go
@ -33,6 +33,9 @@ func NewWatcher(paths []string) {
|
|||||||
if checkTMPFile(e.Name) {
|
if checkTMPFile(e.Name) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
if !checkIsGoFile(e.Name) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
if t, ok := eventTime[e.Name]; ok {
|
if t, ok := eventTime[e.Name]; ok {
|
||||||
// if 500ms change many times, then ignore it.
|
// if 500ms change many times, then ignore it.
|
||||||
@ -135,3 +138,11 @@ func checkTMPFile(name string) bool {
|
|||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// checkIsGoFile return true if the name is HasSuffix go
|
||||||
|
func checkIsGoFile(name string) bool {
|
||||||
|
if strings.HasSuffix(name, ".go") {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user