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

watch

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler func(changed []string) error

Handler is called with the set of changed file paths after debouncing.

type Watcher

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

Watcher watches a directory tree for file changes and calls handler after a debounce window. Only files matching the tracked extensions are reported.

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. It blocks until ctx is cancelled or an error occurs. Uses a debounce window to coalesce rapid saves.

Jump to

Keyboard shortcuts

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