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:
14
watch.go
14
watch.go
@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user