func subscribeTree(watcher *fsnotify.Watcher, root string) {
	subscriptionList := list.New() // The directories we have yet to subscribe to
	subscriptionList.PushFront(root)

	for subscriptionList.Len() > 0 {
		el := subscriptionList.Back()
		cur := el.Value.(string)
		subscriptionList.Remove(el)

		// Get our children
		f, err := os.Open(cur)
		if err != nil {
			panic(err)
		}

		infos, err := f.Readdir(-1)
		if err != nil {
			panic(err)
		}

		// Save the children for later processing
		for _, child := range infos {
			if child.IsDir() {
				path := filepath.Join(cur, child.Name())
				subscriptionList.PushFront(path)
			}
		}

		watcher.Add(cur)
	}
}
// Add the directories under the given
Add the directories under the given
// Add the directories under the given
func subscribeTree(watcher *fsnotify.Watcher, root string) {
	subscriptionList := list.New() 
	subscriptionList.PushFront(root)
	for subscriptionList.Len() > 0 {
		el := subscriptionList.Back()
		cur := el.Value.(string)
		subscriptionList.Remove(el)
		f, err := os.Open(cur)
		if err != nil {
			panic(err)
		}
		infos, err := f.Readdir(-1)
		if err != nil {
			panic(err)
		}
		for _, child := range infos {
			if child.IsDir() {
				path := filepath.Join(cur, child.Name())
				subscriptionList.PushFront(path)
			}
		}
		watcher.Add(cur)
	}
}
func subscribeTree ( watcher * fsnotify . Watcher , root string ) { subscriptionList := list . New ( ) subscriptionList . PushFront ( root ) for subscriptionList . Len ( ) > 0 { el := subscriptionList . Back ( ) cur := el . Value . ( string ) subscriptionList . Remove ( el ) f , err := os . Open ( cur ) if err != nil { panic ( err ) } infos , err := f . Readdir ( - 1 ) if err != nil { panic ( err ) } for _ , child := range infos { if child . IsDir ( ) { path := filepath . Join ( cur , child . Name ( ) ) subscriptionList . PushFront ( path ) } } watcher . Add ( cur ) } }
Add the directories under the given
Add the directories under the given
// The directories we have yet to subscribe to // Get our children // Save the children for later processing