ipn/store: remove a layer of indirection for registering stores (#15986)
Registering a new store is cheap, it just adds a map entry. No need to lazy-init it with sync.Once and an intermediate slice holding init functions. Updates #cleanup Signed-off-by: Andrew Lytvynov <awly@tailscale.com>
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
package store
|
||||
|
||||
import (
|
||||
"maps"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
@@ -14,10 +15,9 @@ import (
|
||||
)
|
||||
|
||||
func TestNewStore(t *testing.T) {
|
||||
regOnce.Do(registerDefaultStores)
|
||||
oldKnownStores := maps.Clone(knownStores)
|
||||
t.Cleanup(func() {
|
||||
knownStores = map[string]Provider{}
|
||||
registerDefaultStores()
|
||||
knownStores = oldKnownStores
|
||||
})
|
||||
knownStores = map[string]Provider{}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user