Help us shape the future of Go! Take the 2026 Go Developer Survey

watch

package
v1.10.1 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Debouncer added in v1.7.3

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

Debouncer collapses bursts of changed files into serialized handler calls.

func NewDebouncer added in v1.7.3

func NewDebouncer(delay time.Duration, handler Handler) *Debouncer

NewDebouncer creates a debouncer for filesystem update cycles.

func (*Debouncer) Stop added in v1.7.3

func (d *Debouncer) Stop()

Stop cancels any pending timer. Running handlers are allowed to finish.

func (*Debouncer) Trigger added in v1.7.3

func (d *Debouncer) Trigger(path string)

Trigger records a changed file and schedules one debounced update cycle.

type Handler

type Handler func(changed []string) error

Handler receives the set of changed file paths after debouncing.

type Watcher

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

Watcher watches a directory tree for relevant file changes.

func New

func New(dir string, exts []string, handler Handler) (*Watcher, error)

New creates a Watcher rooted at dir, watching files with the given extensions.

func (*Watcher) Run

func (w *Watcher) Run(stop <-chan struct{}) error

Run starts the watch loop until stop is closed.

Jump to

Keyboard shortcuts

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