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")
ErrPathNotSet GoPath not set error
Functions ¶
This section is empty.
Types ¶
type AppConfig ¶
type AppConfig struct { DelveArgs []string `yaml:"delve-args,omitempty"` Package struct { Args []string `yaml:"args,omitempty"` } `yaml:"package"` Watcher struct { Run string `yaml:"run"` Watch string `yaml:"watch"` WatchVendor string `yaml:"watch-vendor"` } `yaml:"watcher,omitempty"` }
AppConfig contains the argument information for delve, watcher and main package
func ParseArgs ¶
func ParseArgs(args []string, vinfo VersionInfo) *AppConfig
ParseArgs extracts the application parameters from args and returns Params instance with separated watcher and application parameters
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder composes of both debugger and watcher. Whenever watcher gets notified, builder starts a build process, and forces the debugger to restart
func NewBuilder ¶
NewBuilder constructs the Builder instance
type Debugger ¶ added in v1.12.0
type Debugger struct {
// contains filtered or unexported fields
}
Debugger listens for the change events and depending on that kills the obsolete process, and runs a new one
func NewDebugger ¶ added in v1.12.0
func NewDebugger() *Debugger
NewDebugger creates a new Debugger instance and returns its pointer
func (*Debugger) Close ¶ added in v1.12.0
func (r *Debugger) Close()
Close closes the current debugger
type VersionInfo ¶
VersionInfo contains all the information regarding the version
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