watcher

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const TokenHeader = "X-Nagios-Plugin-Token" //nolint:gosec

Variables

This section is empty.

Functions

func GetAllInDirectory

func GetAllInDirectory(dir string, ignoredExtensions []string) (
	[]string,
	[]string,
	error)

GetAllInDirectory recursively returns all paths to files and directories in dir (excluding files with ignored extensions). It returns nil, nil, <err> on the first error encountered.

func WatchDirectories

func WatchDirectories(
	directories []string,
	provider WatchFuncProvider,
	done <-chan struct{}) error

WatchDirectories watches for changes in directories and calls WatchFn on every change. It terminates after done is closed.

Types

type Change

type Change struct {
	Name string
	Diff string
}

type Differential

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

Differential implements WatchFuncProvider. Use NewDifferential to initialize Differential.

func NewDifferential

func NewDifferential(
	ignoredExtensions, initialFilePaths []string,
	httpClient *http.Client,
	url, token string) (Differential, error)

NewDifferential returns initialized Differential.

func (Differential) WatchFn

func (d Differential) WatchFn(path string) error

type WatchFuncProvider

type WatchFuncProvider interface {
	WatchFn(path string) error
}

Jump to

Keyboard shortcuts

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