diff options
Diffstat (limited to 'worker/handlers/register.go')
-rw-r--r-- | worker/handlers/register.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/worker/handlers/register.go b/worker/handlers/register.go index c94a256e..4123665f 100644 --- a/worker/handlers/register.go +++ b/worker/handlers/register.go @@ -29,15 +29,15 @@ func GetHandlerForScheme(scheme string, worker *types.Worker) (types.Backend, er type WatcherFactoryFunc func() (types.FSWatcher, error) -var watcherFactories map[string]WatcherFactoryFunc = make(map[string]WatcherFactoryFunc) +var watcherFactory WatcherFactoryFunc -func RegisterWatcherFactory(os string, fn WatcherFactoryFunc) { - watcherFactories[os] = fn +func RegisterWatcherFactory(fn WatcherFactoryFunc) { + watcherFactory = fn } func NewWatcher() (types.FSWatcher, error) { - if fn, ok := watcherFactories[runtime.GOOS]; ok { - return fn() + if watcherFactory == nil { + return nil, fmt.Errorf("Unsupported OS: %s", runtime.GOOS) } - return nil, fmt.Errorf("Unsupported OS: %s", runtime.GOOS) + return watcherFactory() } |