codeskyblue/fswatch

fswatch not works.

clinyong opened this issue · 2 comments

Before I used the old version of fswatch, but sometimes would meet some bugs. So I decide to update to the newest version. But I find that it not works. Below is the layout of my sample project.

- bin
- src
    - github.com
    - gopkg.in
    - main
        - main.go
        - routers.go

main.go

package main

import "gopkg.in/macaron.v1"

var (
    m *macaron.Macaron
)

func main() {
    m = macaron.New()

    initRouters()
    m.Run(8181)
}

routers.go

package main

func initRouters() {
    m.Get("/test", func() string {
        return "test"
    })
}

The .fsw.yml file

desc: Auto generated by fswatch [student-card]
triggers:
- name: "watch"
  pattens:
  - '*.go'
  env:
    DEBUG: "1"
  cmd: go build main && mv main bin && ./bin/main
  delay: 100ms
  signal: HUP
watch_paths:
- .
watch_depth: 5

I run below code in the root folder of my project

$ ./bin/main/fswatch -version
2.0
$ ./bin/main/fswatch
fswatch
fswatch >>> [watch] exec start: go build main && mv main bin && ./bin/main
2016/02/17 20:37:14 [main/config.go:36] Reading config file in /home/clinyong/workfile/student-card/conf/default.toml...
[Macaron] listening on 0.0.0.0:8181 (development)

Then I modified routers.go

package main

func initRouters() {
    m.Get("/hello", func() string {
        return "hello"
    })
}

But fswatch didn't trigger the command. My go version is go version go1.5.2 linux/amd64.

Hope you can help me to fix it, thanks.

Change the .fsw.yml to

The .fsw.yml file

desc: Auto generated by fswatch [student-card]
triggers:
- name: "watch"
  pattens:
  - '**/*.go'
  env:
    DEBUG: "1"
  cmd: go build main && mv main bin && ./bin/main
  delay: 100ms
  signal: HUP
watch_paths:
- .
watch_depth: 5

The only difference is from *.go to **/*.go.

Thanks for you feedback, I updated readme just now.

Thanks for your reply.