// Walk fsnotify
549851
func (w *fsNotifyWatcher) Walk(path string, init bool) string {
	if err := w.Add(path); err != nil {
		return ""
	}
	return path
}
288458
func Notify(ctx context.Context, subj, msg string) error {
	return errors.Errorf("GOOS %s not yet supported", runtime.GOOS)
}
1187669
func (f *FS) LaunchNotificationProcessor(ctx context.Context) {
	f.notifications.LaunchProcessor(ctx)
}
695446
func NotifyOnChange(filename string, ops fsnotify.Op, cancel <-chan interface{}) (<-chan struct{}, error) {
	filename = filepath.Clean(filename)
	dir := filepath.Dir(filename)
	w, err := fsnotify.NewWatcher()
	if err != nil {
		return nil, err
	}
	if err := w.Add(dir); err != nil {
		return nil, err
	}
	outchan := make(chan struct{})
	go func() {
		defer w.Close()
		defer close(outchan)
		for {
			select {
			case e := <-w.Events:
				if filepath.Clean(e.Name) == filename && e.Op&ops != 0 {
					outchan <- struct{}{}
				}
			case <-w.Errors:
			case <-cancel:
				return
			}
		}
	}()
	return outchan, nil
}
1346626
func (pn *peernet) Notify(f inet.Notifiee) {
	pn.notifmu.Lock()
	pn.notifs[f] = struct{}{}
	pn.notifmu.Unlock()
}
681546
func watch(root string, watcher *fsnotify.Watcher, names chan<- string, done chan<- error, reflexes []*Reflex) {
	if err := filepath.Walk(root, walker(watcher, reflexes)); err != nil {
		infoPrintf(-1, "Error while walking path %s: %s", root, err)
	}

	for {
		select {
		case e := <-watcher.Events:
			if verbose {
				infoPrintln(-1, "fsnotify event:", e)
			}
			stat, err := os.Stat(e.Name)
			if err != nil {
				continue
			}
			path := normalize(e.Name, stat.IsDir())
			if e.Op&chmodMask == 0 {
				continue
			}
			names <- path
			if e.Op&fsnotify.Create > 0 && stat.IsDir() {
				if err := filepath.Walk(path, walker(watcher, reflexes)); err != nil {
					infoPrintf(-1, "Error while walking path %s: %s", path, err)
				}
			}
			// TODO: Cannot currently remove fsnotify watches
			// recursively, or for deleted files. See:
			// https://github.com/cespare/reflex/issues/13
			// https://github.com/go-fsnotify/fsnotify/issues/40
			// https://github.com/go-fsnotify/fsnotify/issues/41
		case err := <-watcher.Errors:
			done <- err
			return
		}
	}
}
1058087
func Walk(path string, walkFn WalkFunc) error {
	root := strings.TrimSpace(path)
	_, err := os.Lstat(root)
	if err != nil {
		return walkFn(nil, err)
	}
	return walk(root, walkFn)
}
1019873
func (a *aggregator) notify(oldEvents map[string]*aggregatedEvent, out chan<- []string) {
	timeBeforeSending := time.Now()
	l.Debugf("%v Notifying about %d fs events", a, len(oldEvents))
	separatedBatches := make(map[fs.EventType][]string)
	for path, event := range oldEvents {
		separatedBatches[event.evType] = append(separatedBatches[event.evType], path)
	}
	for _, evType := range [3]fs.EventType{fs.NonRemove, fs.Mixed, fs.Remove} {
		currBatch := separatedBatches[evType]
		if len(currBatch) != 0 {
			select {
			case out <- currBatch:
			case <-a.ctx.Done():
				return
			}
		}
	}
	// If sending to channel blocked for a long time,
	// shorten next notifyDelay accordingly.
	duration := time.Since(timeBeforeSending)
	buffer := time.Millisecond
	var nextDelay time.Duration
	switch {
	case duration < a.notifyDelay/10:
		nextDelay = a.notifyDelay
	case duration+buffer > a.notifyDelay:
		nextDelay = buffer
	default:
		nextDelay = a.notifyDelay - duration
	}
	select {
	case a.notifyTimerResetChan <- nextDelay:
	case <-a.ctx.Done():
	}
}
1086464
func Walk(container Container, prefix string, pageSize int, fn WalkFunc) error {
	var (
		err    error
		items  []Item
		cursor = CursorStart
	)
	for {
		items, cursor, err = container.Items(prefix, cursor, pageSize)
		if err != nil {
			err = fn(nil, err)
			if err != nil {
				return err
			}
		}
		for _, item := range items {
			err = fn(item, nil)
			if err != nil {
				return err
			}
		}
		if IsCursorEnd(cursor) {
			break
		}
	}
	return nil
}
94213
func (s *Space) Walk(fn func(name string, lvs LabelValues, observations []float64) bool) {
	s.mtx.RLock()
	defer s.mtx.RUnlock()
	for name, node := range s.nodes {
		f := func(lvs LabelValues, observations []float64) bool { return fn(name, lvs, observations) }
		if !node.walk(LabelValues{}, f) {
			return
		}
	}
}
595158
func (p *Project) Notify(eventType events.EventType, serviceName string, data map[string]string) {
	if eventType == events.NoEvent {
		return
	}

	event := events.Event{
		EventType:   eventType,
		ServiceName: serviceName,
		Data:        data,
	}

	for _, l := range p.listeners {
		l <- event
	}
}
582359
func (k KeybaseServiceMeasured) Notify(ctx context.Context, notification *keybase1.FSNotification) (err error) {
	k.notifyTimer.Time(func() {
		err = k.delegate.Notify(ctx, notification)
	})
	return err
}
540767
func Walk(sd *ServiceDefinition, visit Visit) error {
	if err := visit(sd); err != nil {
		return err
	}
	for _, def := range sd.Services {
		if err := Walk(&def, visit); err != nil {
			return err
		}
	}
	return nil
}
1316813
func Walk(s Shape, fnc WalkFunc) {
	if s == nil {
		return
	}
	if !fnc(s) {
		return
	}
	walkReflect(reflect.ValueOf(s), fnc)
}
639997
func (ftp *FTP) Walk(path string, walkFn WalkFunc) (err error) {
	/*
		if err = walkFn(path, os.ModeDir, nil); err != nil {
			if err == filepath.SkipDir {
				return nil
			}
		}
	*/
	if ftp.debug {
		log.Printf("Walking: '%s'\n", path)
	}

	var lines []string

	if lines, err = ftp.List(path); err != nil {
		return
	}

	for _, line := range lines {
		_, t, subpath := parseLine(line)

		switch t {
		case "dir":
			if subpath == "." {
			} else if subpath == ".." {
			} else {
				if err = ftp.Walk(path+subpath+"/", walkFn); err != nil {
					return
				}
			}
		case "file":
			if err = walkFn(path+subpath, os.FileMode(0), nil); err != nil {
				return
			}
		}
	}

	return
}
157038
func (b *Box) walk(path string, info os.FileInfo, walkFn filepath.WalkFunc) error {

	err := walkFn(path, info, nil)
	if err != nil {
		if info.IsDir() && err == filepath.SkipDir {
			return nil
		}
		return err
	}

	if !info.IsDir() {
		return nil
	}

	names, err := b.readDirNames(path)
	if err != nil {
		return walkFn(path, info, err)
	}

	for _, name := range names {

		filename := filepath.ToSlash(filepath.Join(path, name))
		fileObject, err := b.Open(filename)
		if err != nil {
			return err
		}
		defer fileObject.Close()

		fileInfo, err := fileObject.Stat()
		if err != nil {
			if err := walkFn(filename, fileInfo, err); err != nil && err != filepath.SkipDir {
				return err
			}
		} else {
			err = b.walk(filename, fileInfo, walkFn)
			if err != nil {
				if !fileInfo.IsDir() || err != filepath.SkipDir {
					return err
				}
			}
		}
	}

	return nil

}
1294868
func walk(fileName string, walkFn WalkFunc) error {
	r, err := zip.OpenReader(fileName)
	if err != nil {
		return err
	}
	defer r.Close()
	for _, f := range r.File {
		err := walkFn(f, nil)
		if err != nil {
			return err
		}
	}
	return nil
}