Add support for automatic reloading the config when it has been changed#50
Add support for automatic reloading the config when it has been changed#50dolfje wants to merge 2 commits intomuesli:masterfrom
Conversation
|
Thanks for this! General recommendation when getting started with Go: make sure your IDE/editor uses Alternatively you can also run this manually on the command line: gofmt -w *.go |
deck.go
Outdated
| select { | ||
| case event := <-watcher.Events: | ||
| if currentDeck == path { | ||
| fmt.Println("Change: %s: %s", event.Op, event.Name) |
There was a problem hiding this comment.
Careful, Println doesn't expect formatting directives like %s. You'll have to use Printf here and finish it with a \n for a newline.
| d.Widgets = append(d.Widgets, w) | ||
| } | ||
|
|
||
| watcher, err := fsnotify.NewWatcher() |
There was a problem hiding this comment.
Make sure to check the error assignments for this line and the one below. Two options here:
- Consider this feature optional, and if an error occurs while setting up the file-watcher, we continue without config monitoring
- Propagate the error, so we can display an error to the user:
if err != nil {
return nil, err
}
No description provided.