watch

package
v0.0.0-...-b2dc7b4 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: BSD-3-Clause Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Ignored

type Ignored func(relative string) bool

Ignored reports whether a path relative to the root should be skipped.

func PrefixIgnored

func PrefixIgnored(ignores func(string) bool) Ignored

PrefixIgnored adapts a path-based predicate so a directory is skipped when the directory itself, with a trailing slash, is ignored.

type Watcher

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

Watcher reports changes beneath a directory.

func Start

func Start(root string, ignored Ignored, changed func(string)) (*Watcher, error)

Start watches a directory tree, calling changed with each relative, slash-separated path.

An ignored directory is not descended into, so a node_modules with tens of thousands of files costs nothing -- which is also the difference between working and hitting the per-process watch limit on Linux.

func (*Watcher) Close

func (w *Watcher) Close() error

Close stops watching and waits for any change already being handled, so no callback runs once it returns. It is safe to call more than once.

Jump to

Keyboard shortcuts

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