From 79eb071e6a661b9b3df14df9791558eb03c4c8b9 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Sun, 3 Mar 2019 01:59:14 +0100 Subject: callbacks: use cb as receiver for unregister --- conf/storewatcher.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'conf') diff --git a/conf/storewatcher.go b/conf/storewatcher.go index 7a5ab387..ffd20ee0 100644 --- a/conf/storewatcher.go +++ b/conf/storewatcher.go @@ -5,20 +5,20 @@ package conf -type storeCallback struct { +type StoreCallback struct { cb func() } -var storeCallbacks = make(map[*storeCallback]bool) +var storeCallbacks = make(map[*StoreCallback]bool) -func RegisterStoreChangeCallback(cb func()) *storeCallback { +func RegisterStoreChangeCallback(cb func()) *StoreCallback { startWatchingConfigDir() cb() - s := &storeCallback{cb} + s := &StoreCallback{cb} storeCallbacks[s] = true return s } -func UnregisterStoreChangeCallback(cb *storeCallback) { +func (cb *StoreCallback) Unregister() { delete(storeCallbacks, cb) } -- cgit v1.2.3-59-g8ed1b