Fixed some bug - #4
Conversation
shanzi
left a comment
There was a problem hiding this comment.
首先感谢您的 PR!
Review 过您的修改之后感觉还请您再整理一下代码,而且有些逻辑跟原来的设计偏差有点大,所以恐怕暂时不能merge。
| info, err := os.Stat(fp.Name) | ||
| if err == nil && info.IsDir() { | ||
| // Add newly created sub directories to watch list | ||
| log.Printf("Add newly diectory ( %s )\n", fp.Name) |
|
|
||
| if os.IsNotExist(err) { | ||
| log.Printf("Dictory (%s) have been removed\n", fp) | ||
| log.Println("here=======here") |
|
|
||
| haveDir := false | ||
| for _, fileinfo := range fileInfos { | ||
| if fileinfo.IsDir() == true && fileinfo.Name() != "." && fileinfo.Name() != ".git" { |
There was a problem hiding this comment.
感觉作为一个简单的 utility 直接 ignore 掉 .git 并不好。
我觉得在使用过程中指定需要侦听的文件类型就应该够用了。对于 .git 这种需求可以做一个选项出来。直接 hard code 不好。
There was a problem hiding this comment.
您之前的方案,会把.git下的文件全部都监控起来,我真的不明白监控.git文件有什么特殊的用意。
| "os" | ||
| "os/signal" | ||
| "path/filepath" | ||
| // "wu/command" |
| // Run the command once at initially | ||
| r.command.Start(200 * time.Millisecond) | ||
| haveBuild := false | ||
| r.command.Start(200*time.Millisecond, haveBuild) |
There was a problem hiding this comment.
目前的提示就是done 但是我想合理的提示应该是编译成功一次之后 之后就是重新启动了 你觉得呢
| continue | ||
| } | ||
|
|
||
| if filepath.Ext(fileinfo.Name()) == ".go" { |
There was a problem hiding this comment.
hmmm 这里 hardcode 了 go ,如果想要讲 wu 用在其他地方就没办法了吧。这么做有什么理由么?
There was a problem hiding this comment.
wu 按照我的理解新的逻辑只会侦听有 Go 源文件存在的目录,也不会在新建文件和文件夹出现的时候自动加入侦听。这和以前的逻辑偏差太大。恐怕不能接受
There was a problem hiding this comment.
是不是做成配置的形式就可以接受了呢,另外监控go文件应该是合理的,如果想要监控其他的类型,比如html这就需要把这部分从配置里读取出来了。
新建文件夹会加入监听的啊。后半部分你讲的我不是太明白
1: 修复了删除文件空指针错误的问题
2:增加了监控目录提示
3: 改善了启动和再次启动的提示代码
4:修复了文件改变之后但是终端会提示提示两次的问题
5: 移除了部分代码
6:过滤.git文件(噪音文件)
7: 新增readAppDirectories,获取需要监控的目录