1
0
mirror of https://github.com/beego/bee.git synced 2025-07-03 15:20:17 +00:00

Able to customize watch file exts

This commit is contained in:
Unknown
2013-09-04 11:23:51 -04:00
parent 540122fdf1
commit 111bc16e19
3 changed files with 15 additions and 7 deletions

View File

@ -50,7 +50,7 @@ func NewWatcher(paths []string) {
if checkTMPFile(e.Name) {
continue
}
if !checkIsGoFile(e.Name) {
if !chekcIfWatchExt(e.Name) {
continue
}
@ -178,10 +178,14 @@ func checkTMPFile(name string) bool {
return false
}
// checkIsGoFile returns true if the name HasSuffix ".go".
func checkIsGoFile(name string) bool {
if strings.HasSuffix(name, ".go") {
return true
var watchExts = []string{".go"}
// chekcIfWatchExt returns true if the name HasSuffix <watch_ext>.
func chekcIfWatchExt(name string) bool {
for _, s := range watchExts {
if strings.HasSuffix(name, s) {
return true
}
}
return false
}