watch

package
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package watch reports the files that change below a folder, a burst of changes at a time.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Watcher

type Watcher struct {
	// contains filtered or unexported fields
}

Watcher reports the changes below a folder.

func New

func New(root string, skip func(rel string) bool, quiet time.Duration) (*Watcher, error)

New watches root and every folder below it for which skip(rel) is false, where rel is the slash-separated path relative to root. It adds folders as they appear, and sends the changed paths of each burst once no change has come for quiet.

func (*Watcher) Changes

func (w *Watcher) Changes() <-chan []string

Changes gets the changed paths of each burst: absolute, sorted and each once. It is closed when the watcher stops.

func (*Watcher) Close

func (w *Watcher) Close() error

Close stops the watcher and waits until Changes is closed.

func (*Watcher) Errors

func (w *Watcher) Errors() <-chan error

Errors gets the folders that cannot be watched and the watcher's own failures; it drops them while nobody reads. It is closed when the watcher stops.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL