-
-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for automatic reloading the config when it has been changed #50
base: master
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
@@ -70,6 +72,32 @@ func LoadDeck(dev *streamdeck.Device, base string, deck string) (*Deck, error) { | |||
d.Widgets = append(d.Widgets, w) | |||
} | |||
|
|||
watcher, err := fsnotify.NewWatcher() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.