git.iko.soy/typeable/oauth2-proxy
on master help sign in
Fix validator_test hang on Solaris, Plan 9
c3590b5Mike Bland
validator.go+1−4
@@ -21,13 +21,10 @@ func NewUserMap(usersFile string, done <-chan bool, onUpdate func()) *UserMap {
21 atomic.StorePointer(&um.m, unsafe.Pointer(&m))
21 atomic.StorePointer(&um.m, unsafe.Pointer(&m))
22 if usersFile != "" {
22 if usersFile != "" {
23 log.Printf("using authenticated emails file %s", usersFile)
23 log.Printf("using authenticated emails file %s", usersFile)
24− started := WatchForUpdates(usersFile, done, func() {
24+ WatchForUpdates(usersFile, done, func() {
25 um.LoadAuthenticatedEmailsFile()
25 um.LoadAuthenticatedEmailsFile()
26 onUpdate()
26 onUpdate()
27 })
27 })
28− if started {
29− log.Printf("watching %s for updates", usersFile)
30− }
31 um.LoadAuthenticatedEmailsFile()
28 um.LoadAuthenticatedEmailsFile()
32 }
29 }
33 return um
30 return um
watcher.go+2−2
@@ -30,7 +30,7 @@ func WaitForReplacement(filename string, op fsnotify.Op,
30 }
30 }
31}
31}
32
32
33−func WatchForUpdates(filename string, done <-chan bool, action func()) bool {
33+func WatchForUpdates(filename string, done <-chan bool, action func()) {
34 filename = filepath.Clean(filename)
34 filename = filepath.Clean(filename)
35 watcher, err := fsnotify.NewWatcher()
35 watcher, err := fsnotify.NewWatcher()
36 if err != nil {
36 if err != nil {
@@ -65,5 +65,5 @@ func WatchForUpdates(filename string, done <-chan bool, action func()) bool {
65 if err = watcher.Add(filename); err != nil {
65 if err = watcher.Add(filename); err != nil {
66 log.Fatal("failed to add ", filename, " to watcher: ", err)
66 log.Fatal("failed to add ", filename, " to watcher: ", err)
67 }
67 }
68− return true
68+ log.Printf("watching %s for updates", filename)
69}
69}
watcher_unsupported.go+2−2
@@ -6,7 +6,7 @@ import (
6 "log"
6 "log"
7)
7)
8
8
9−func WatchForUpdates(filename string, done <-chan bool, action func()) bool {
9+func WatchForUpdates(filename string, done <-chan bool, action func()) {
10 log.Printf("file watching not implemented on this platform")
10 log.Printf("file watching not implemented on this platform")
11− return false
11+ go func() { <-done }()
12}
12}