Documentation ¶
Overview ¶
Package watcher is a command line tool inspired by fresh (https://github.com/pilu/fresh) and used for watching .go file changes, and restarting the app in case of an update/delete/add operation. After you installed it, you can run your apps with their default parameters as: watcher -c config -p 7000 -h localhost
Package watcher watches all file changes via fsnotify package and sends update events to builder
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrPathNotSet = errors.New("gopath not set")
GoPath not set error
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder composes of both runner and watcher. Whenever watcher gets notified, builder starts a build process, and forces the runner to restart
func NewBuilder ¶
NewBuilder constructs the Builder instance
type Params ¶
type Params struct { // Package parameters Package []string // Go-Watcher parameters Watcher map[string]string }
Params is used for keeping go-watcher and application flag parameters
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
Runner listens for the change events and depending on that kills the obsolete process, and runs a new one
type Watcher ¶
type Watcher struct {
// contains filtered or unexported fields
}
Watcher watches the file change events from fsnotify and sends update messages. It is also used as a fsnotify.Watcher wrapper
func MustRegisterWatcher ¶
MustRegisterWatcher creates a new Watcher and starts listening to given folders