1
0
mirror of https://github.com/oauth2-proxy/oauth2-proxy.git synced 2025-06-21 00:29:44 +02:00

Fixup main

This commit is contained in:
Joel Speed
2021-10-06 17:12:03 +01:00
parent c2acf47199
commit 8356d29fcd
5 changed files with 31 additions and 22 deletions

View File

@ -26,7 +26,7 @@ func WaitForReplacement(filename string, op fsnotify.Op,
for {
if _, err := os.Stat(filename); err == nil {
if err := watcher.Add(filename); err == nil {
infoLogger.Infof("watching resumed for %s", filename)
infoLogger().Infof("watching resumed for %s", filename)
return
}
}
@ -51,7 +51,7 @@ func WatchForUpdates(filename string, done <-chan bool, action func()) {
for {
select {
case <-done:
infoLogger.Infof("Shutting down watcher for: %s", filename)
infoLogger().Infof("Shutting down watcher for: %s", filename)
return
case event := <-watcher.Events:
// On Arch Linux, it appears Chmod events precede Remove events,
@ -60,7 +60,7 @@ func WatchForUpdates(filename string, done <-chan bool, action func()) {
// UserMap.LoadAuthenticatedEmailsFile()) crashes when the file
// can't be opened.
if event.Op&(fsnotify.Remove|fsnotify.Rename|fsnotify.Chmod) != 0 {
infoLogger.Infof("Watching interrupted on event: %s", event)
infoLogger().Infof("Watching interrupted on event: %s", event)
err = watcher.Remove(filename)
if err != nil {
klog.Errorf("error removing watcher on %s: %v", filename, err)
@ -77,5 +77,5 @@ func WatchForUpdates(filename string, done <-chan bool, action func()) {
if err = watcher.Add(filename); err != nil {
klog.Fatalf("Failed to add %s to watcher: %v", filename, err)
}
infoLogger.Infof("Watching %s for updates", filename)
infoLogger().Infof("Watching %s for updates", filename)
}